How to know the app was launched from an AppIntent in a widget?

Is it possible to tell in your code if the app was launched from an app intent action in a widget.

In my SwiftUI code it has something like Button(intent: MyIntent()) I want to be able to tell when the user has clicked on the button to launch the app, because I need some different setup code to run before the intent perform method is called.

Thanks

Try it and examine the launch options in didFinishLaunchingWithOptions to see if there's anything there. If not then if you widget gets the chance to, then it could write a flag to group defaults which the app reads on launch.

I think the only way is to share information with the app through App Group or URL parameters and process the desired task in the app. A long time ago, there were ways to get information about running processes in iOS, but they have all been abandoned.

How to know the app was launched from an AppIntent in a widget?
 
 
Q