iosswiftsirishortcutsappintentsapp-shortcut

Siri only uses first App Shortcut defined


Using App Shortcuts with app intents, Siri only responds to the first shortcut defined in the app shortcut below.

struct MementoShortcuts: AppShortcutsProvider {
    @AppShortcutsBuilder
    static var appShortcuts: [AppShortcut] {
        AppShortcut(
            intent: SaveLinkIntent(),
            phrases: ["Add a link to \(.applicationName)", "Add \(\.$url) to \(.applicationName)", "Make a new link in \(.applicationName)", "Create a new link in \(.applicationName) from \(\.$url)"],
            shortTitle: "Add Link",
            systemImageName: "link.badge.plus"
        )
        AppShortcut(
            intent: LinkViewedIntent(),
            phrases: [
                "Mark a link I saved in \(.applicationName) as viewed",
                "Mark \(\.$link) as viewed in \(.applicationName)",
                "Set link in \(.applicationName) to viewed",
                "Change status of \(\.$link) to viewed in \(.applicationName)",
            ],
            shortTitle: "Mark Link as Viewed",
            systemImageName: "book"
        )
    }
}

I have tried switching the order of which is defined first for debugging purposes and she always uses the one that comes first. Both show up in the shortcuts app as an app shortcut, but only one shortcut is recognized by Siri even if I say the other one's phrase. For instance, in this scenario, when SaveLinkIntent() is defined first, no matter if I say the phrase, "Siri, change the status of (link name) in (app name)" she will still do SaveLinkIntent() even though I said the LinkViewedIntent() phrase.

I haven't seen anyone else with this problem and from my research into App Shortcuts, and looking at the documentation from Apple, it seems I am using syntax in line with the norm. Has anyone else experienced this before?


Solution

  • I found the solution! I just need to be using @AppShortcutsBuilder on top of the static var appShortcuts