title: Adding a view to the window hierarchy
body: <p>I am trying to create a pause screen on my game. I have added a 'PauseScreen' viewController in my storyboard with the Storyboard ID and Restoration ID set as "PauseScreenID" and to move to the pause screen I have have created the function in "GameScene" :</p>
  
  <pre><code>func pauseSceenTransition(){
  
      let viewController = UIStoryboard(name: "Main", bundle:nil).instantiateViewControllerWithIdentifier("PauseScreenID") as UIViewController
  
      let currentViewController = (UIApplication.sharedApplication().delegate as AppDelegate)
  
      currentViewController.window?.rootViewController?.presentViewController(viewController, animated: false, completion: nil)
  }
  </code></pre>
  
  <p>However when the it gets called, I get the error : </p>
  
  <p>Warning: Attempt to present &lt;<em>AppName</em>.PauseScreen: 0x7fae61fe5ff0> on &lt;<em>AppName</em>.StartScreenViewController: 0x7fae61f79980> whose view is not in the window hierarchy!</p>
  
  <p>The "StartScreenViewController" is the view controller for my start screen and is the initial view controller. It then goes to the "GameScene" which is where the "PauseScreen" needs to go. It works if I make the initial view controller the "GameViewController"/"GameScene" so I presume that I need to change the second line:</p>
  
  <pre><code>let currentViewController = (UIApplication.sharedApplication().delegate as AppDelegate)
  </code></pre>
  
  <p>so that it is presenting the "PauseScreen" on the "GameViewController", not on the "StartScreenViewController" but I'm not sure how to do that.</p>