chitranjan deo chitranjan deo - 2 months ago 40
Swift Question

Sirikit and parent app communication in ios 10 : Handoff

I am using Sirikit to integrate with my payment domain app where I need to interact with the app. I read Apple documentation, they asked to use common frameworks.
Is it possible to use handoff? if yes then how?
How can I call the other viewController which is in parent app from sirikit?

I will really appreciate for any help. Thanks

Answer

Check SiriKit Programming Guide,

To use handoff, You can create intent response object with NSUserActivity object. While creating NSUserActivity object assign userInfo property to appropriate object that you want,

let userActivity = NSUserActivity()
userActivity.userInfo = ["myKey": myAnyObject]

You will get this NSUserActivity object in parent application AppDelegate,

optional public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Swift.Void) -> Bool

Here you can get userInfo object which you can compare as per your requirement and call appropriate viewController.

Comments