Hello everyone,
I want to add preconfigured app shortcuts for my app using an AppShortcutsProvider
implementation. I have been following this demo from WWDC22: https://developer.apple.com/wwdc22/10170
All looks pretty straight forward.
However, I would like the preconfigured shortcuts to be based on the state of the data in the app: adding one shortcut for every user-entered item in a list.
Now, this might be due to the fact that I'm a Swift novice, but I can't figure out how to do that from a AppShortcutsBuilder property as I can't create the AppShortcut instances in a for loop. I have failed to find any resources online on this. I assume I would need the ForEach
equivalent of the ViewBuilder
? Is anything like that available for AppShortcutsBuilder
?
I have also stumbled on this: https://developer.apple.com/documentation/sirikit/offering_actions_in_the_shortcuts_app
But this solution seems to only work with INIntents
rather than AppIntents
. Is there a setShortcutSuggestions
equivalent for AppIntents
that I could call when the contents of my list change?