title: Get Instance Of ViewController From AppDelegate In Swift
body: <p>I am trying to load a specific ViewController from the app delegate in swift when a user clicks a UILocalNotification. I have figured out that this is called in this function:</p>
  
  <pre><code>func application(application: UIApplication!, didReceiveLocalNotification notification: UILocalNotification!)
  </code></pre>
  
  <p>But when I try and access one of the open ViewControllers I think it's returning null because my application is crashing. Here is what I am trying:</p>
  
  <pre><code>var rootViewController = self.window!.rootViewController
  var storyBoard = rootViewController.storyboard
  var setViewController = storyBoard.instantiateViewControllerWithIdentifier("CurrentShows") as ViewController_CurrentShows
  
  rootViewController.navigationController.popToViewController(setViewController, animated: false)
  setViewController.reloadData()
  </code></pre>
  
  <p>It's crashing on the popToViewController line. </p>