According to the Branch documentation, we’re supposed to implement this to navigate to another view when a user taps on a deep link:
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
print(params as? [String: AnyObject] ?? {})
guard let data = params as? [String: AnyObject] else { return }
guard let options = data["nav_to"] as? String else { return }
switch options {
case "landing_page": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
case "tutorial": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
case "content": self.window?.rootViewController?.present( SecondViewController(), animated: true, completion: nil)
default: break
}
}
return true
}
}
Which is fine, except I’m using SwiftUI, so using the window and rooViewController to present a new view is not possible.
And they have no documentation to support SwiftUI.
So what do I need to do to navigate to a view when a user taps on a deep link?