How to correctly use AppIntentsExtension with AppShortcutsProvider

I've watched the following 3 WWDC videos on intents and after watching, decided to try and implement an AppIntentsExtension. All my intent action does is run a network request in the background. So it seems like I should be putting it in an AppIntentsExtension instead of in the main app to avoid having to launch the app in the background, and instead have it run directly in the extension.

2022 https://developer.apple.com/videos/play/wwdc2022/10032?time=1620

2023 https://developer.apple.com/videos/play/wwdc2023/10103?time=880

2024 https://developer.apple.com/videos/play/wwdc2024/10134/?time=992

If I just put the intent and shortcut provider code I need inside an AppIntentsExtension, everything works fine except for 1 thing.

I have no way to call updateAppShortcutParameters on my AppShortcutsProvider from the main app because it is defined inside the extension. So I have no way to let siri know to re-query my parameterized phrases, and so siri doesnt expose any new phrases when things in the app are updated.

So to solve this, I somehow need a way to access the AppShortcutsProvider from within the main app to be able to call updateAppShortcutParameters https://developer.apple.com/documentation/appintents/appshortcutsprovider/updateappshortcutparameters()

What is the recommended way to do this? Should I be trying to create a separate framework with the shortcut provider, which is then used by both the main app an extension? I tried doing this but ran into a few build errors. I tried changing the target membership of the AppShortcutsProvider to have the file in the extension, but include both the main app and intent extension, this seems to work, but I am unsure if this is the correct approach.

Answered by DTS Engineer in 806729022

I see you added your questions to an existing thread on this topic, so I'll respond over in that thread.

—Ed Ford,  DTS Engineer

Accepted Answer

I see you added your questions to an existing thread on this topic, so I'll respond over in that thread.

—Ed Ford,  DTS Engineer

How to correctly use AppIntentsExtension with AppShortcutsProvider
 
 
Q