Search code examples
swiftappdelegatenavigationcontroller

Swift: How do I get access to the navigationController in AppDelegate


I have added a NavigationController in the StoryBoard and made it the initial viewController. How do I get access to the NavigationController in the appDelegate. Ctrl-drag from navigationController to AppDelegate does not create an outlet.


Solution

  • In didFinishLaunchingWithOptions:

    let navigationController = application.windows[0].rootViewController as! UINavigationController