Dynamically generating AppShortcut phrases

I want to be able to dynamically update the phrase dictionary in an AppShortcut. However, whenever I abstract the phrases, the shortcut fails to display. That is, I am trying to do:

static var phrases: [AppShortcutPhrase<MyIntent>] = ["\(.applicationName) hello world"]

AppShortcut(

        intent: MyIntent(),
        phrases: phrases,
        shortTitle: "hello world",
        systemImageName: ""
    )

However, the following works:

AppShortcut(

        intent: MyIntent(),
        phrases: "\(.applicationName) hello world",
        shortTitle: "hello world",
        systemImageName: ""
    )

So, what gives?

Answered by DTS Engineer in 823969022

The phrases array for an App Shortcut is statically extracted during the build of your app. This process means that the content cannot be altered dynamically. The system automatically provides you with flexible phrase matching, so phrases from your customer that are similar to the ones you set in your App Shortcut code will still be matched to your App Shortcut by the system.

— Ed Ford,  DTS Engineer

The phrases array for an App Shortcut is statically extracted during the build of your app. This process means that the content cannot be altered dynamically. The system automatically provides you with flexible phrase matching, so phrases from your customer that are similar to the ones you set in your App Shortcut code will still be matched to your App Shortcut by the system.

— Ed Ford,  DTS Engineer

Then in that case what is AppShortcuts.updateAppShortcutParameters() used for?

I am currently looking at some example code that allows me to do just that, but it's a little convoluted so I am trying to simplify it. It allows me to dynamically update the prompt phrases in a shortcut by calling the shortcut provider with new phrases then calling the update function above.

We have to update the prompts dynamically based on user's needs...or be able to get the raw string used to launch a shortcut and parse out the needed fields on demand. I have found several discussions that say the latter is not possible, but several that imply the former is. How can this be accomplished?

Dynamically generating AppShortcut phrases
 
 
Q