swiftuiappintentsapp-shortcut

Some of my iOS AppShortcut phrases work, but some launch Safari?


One of my intents responds to an optional parameter. The parameter is defined as an enum with 4 values (case today, week, month, year). I have 2 AppShortcut phrases defined, one that does not specify the parameter and another which does.

    AppShortcut(intent: TopCardsIntent(),
                    phrases: [
                        "show \(.applicationName) top cards",
                        "show \(.applicationName) top cards for \(\.$timeframe)",
                    ],
                    systemImageName: "atom"
    )

The 1st phrase (with no $timeframe) ALWAYS is interpreted by Siri as a Safari lookup. The 2nd phrase ALWAYS works, but only when I don't specify timeframes '.today' or '.year'. When I do specify '.today' or '.year' - I again always get a Safari lookup.

I've tried all sorts of goofy debugging. Thinking maybe it's because '.today' is 1st and '.year' is the last enum value defined, I added a .decade value. So, the '.decade' works perfect, but '.year' still doesn't. #RandomAF

There are lots of AppShortcut phrases which I'm trying to use that always result in Safari lookups. It almost feels as if Safari has it's own set of AppShortcut phrases, and these are evaluated before mine.

Any ideas?


Solution

  • I didn’t realize this, but there’s an (i) button in Apple’s Shortcuts app - and when tapped it shows 2 toggles. One of which enables Spotlight, and the other enables Siri.

    The solution to my question was provided via Apple’s Feedback Assistant - I just needed to (a) know about this setting, and (b) ensure the Siri toggle was turned on.