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

RawMean picture RawMean · Jul 31, 2014 · Viewed 17.2k times · Source

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.

Answer

zisoft picture zisoft · Jul 31, 2014

In didFinishLaunchingWithOptions:

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