iOS Universal links

Implemented Universal Links today. I think this is essential for a platform in which you can share content through links like you will be able to do with Votavi .

It was actually a pretty simple implementation, the biggest challenge is getting AppDelegate to perform the open action in the right viewcontroller. By using this piece of code you will be able to return to the rootviewcontroller, in our case this is the mainViewController.


if let mainViewController = navController.viewControllers.first as? mainViewController {
navController.topViewController?.dismiss(animated: false, completion: {
navController.popToRootViewController(animated: false)
})
}

Where navcontroller is the UINavigationController via :

(if let navController = window?.rootViewController as? UINavigationController {)

This will get you to the mainViewController which is the root viewController.

 

Related Post