Resolving AppIntent in the app from a widget...

Is anyone familiar with AppIntents and their usage? I have an AppIntent defined in my widget extension. I have the same AppIntent defined in the app marked as ForegroundContinuableIntent. If I add the intent on a SwiftUI button and tap the Button it correctly resolves the app's version of the intent and performs that intent. However, what I really want to do is perform the AppIntent manually as the timeline updates but not more often than every hour (i.e. >= 1 hour). It's easy enough to handle the timing in the timeline. However, I do not know how to resolve the intent such that it calls the app's version of the intent (i.e. the same way that a Button does). If I just call perform it will run the version in the widget extension. The end goal is to minimally / periodically sync with the app. Thanks in advance for any help / advice on this.

Rather than focusing on an intent in this case, it would be better to focus on refactoring your code so that the important code paths in your intent's perform method are shared in a way that they can be used by both that intent when it is run by the user, and also from the code that runs during your timeline refreshes. Since you have your intent code in both targets, I'd start by looking into a framework to share that code as a starting point, and then go from there.

— Ed Ford,  DTS Engineer

That would be a very nice idea. It was the first one that I explored. Unfortunately the team that owns that code is not open to making it accessible to an external native client. I might be able to do the work myself but that is another layer of diplomacy to work through. Additionally I'm not sure how separable that code is. If I have to bring in a bunch of dependencies then it might increase the footprint of the widget unnecessarily. Right now the widget is clean and does not bring in a lot of dependencies from the monolithic app.

I was really hoping I could use the same mechanism that you use to perform the code in the AppIntent in the app. This would at least solve the problem in the short term.

Since you have a ForegroundContinuableIntent, you could also look at the supportedModes property that replaces ForegroundContinuableIntent in the iOS 26 SDK, and perhaps some of the options that provides will help meet your needs.

— Ed Ford,  DTS Engineer

Resolving AppIntent in the app from a widget...
 
 
Q