Passing data from Scene Delegate to ViewController when opening app with URL

Managed to fix it by initialising the controller again and updating the root controller.

// SceneDelegate

func changeRootViewController(_ vc: UIViewController, animated: Bool = true)
    guard let window = self.window else {
    window.rootViewController = vc


let storyboard = UIStoryboard(name: "Main", bundle: nil)
let destinationNavigationController = storyboard.instantiateViewController(withIdentifier: "ViewController2")
(UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate)?.changeRootViewController(destinationNavigationController)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top