Shortcuts gallery issue

When working with AppIntents API, if you having issues with Shortcuts app displaying your app icon in the gallery. There’s a small trick which can fix it.

Caffeine++ Shorcuts fallery with 3 shorcuts

The trick is to return app shortcuts not as array but using the “builder syntax”. I am not familiar with this technique.

Learn from my code example which is based on this gist which I found on Apple forum.

import AppIntents

struct LibraryAppShortcuts: AppShortcutsProvider {

    static var appShortcuts: [AppShortcut] {

        AppShortcut(intent: LogFirstDrink(),
                    phrases: ["Log my favourite in \(.applicationName)"],
                    shortTitle: "Log my favourite",
                    systemImageName: "1.circle")

        AppShortcut(intent: LogLabelledDrink(),
                    phrases: ["Log a drink with \(.applicationName)"],
                    shortTitle: "Log any favourite",
                    systemImageName: "cup.and.saucer")

        AppShortcut(intent: LogFirstDrinkAtCustomDate(),
                    phrases: ["Log with date in \(.applicationName)"],
                    shortTitle: "Forgot to log my favourite",
                    systemImageName: "clock.arrow.trianglehead.counterclockwise.rotate.90")
    }
}

This bug fix will be one of many I am shipping for Caffeine++ 3.