Reputation: 628
I am working with Siri shortcuts. I wanted to know if my app is launched from a Siri shortcut in the following cases:
For case 2, I can use the "didFinishLaunchingWithOptions" method but for case 1, I am not sure what approach to use.
I would appreciate any suggestions and thoughts on this topic. Thank you.
Upvotes: 0
Views: 1167
Reputation: 12405
You can implement this check in your AppDelegate
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if #available(iOS 12.0, *) {
if userActivity.interaction?.intent is {YOUR_INTENT_CLASS} {
// App launched via that particular shortcut.
}
}
}
Upvotes: 1