title: iOS Switch between 2 Navigation controller
body: <p>In my app, if the user isn't logged, it shows a login controller which is embedded in a navigation controller.
  When the user is logged, the app should switch to the other navigation controller to display the app.</p>
  
  <p>How can I switch from one navigation controller to another one when the user is logged. ?</p>
  
  <p>Thanks</p>
  
  <p><a href="https://i.stack.imgur.com/BCely.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BCely.png" alt="enter image description here"></a></p>
  
  <p>I'm checking if the user is log in app delegate :</p>
  
  <pre><code> // Check if user is log
      let currentUser = PFUser.currentUser()
      if currentUser != nil {
          // Do stuff with the user
      } else {
          // Show the signup or login screen
          let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
          let nav = mainStoryboardIpad.instantiateViewControllerWithIdentifier("LogInController") as! UINavigationController
          self.window?.rootViewController = nav
      }
  </code></pre>
  
  <p><strong>SOLUTION : looks like it works</strong><br>
  When user press logIn button :</p>
  
  <pre><code>let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
      let nav = mainStoryboardIpad.instantiateViewControllerWithIdentifier("MainNavController") as! UINavigationController
      let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
      appDelegate.window?.rootViewController = nav
  </code></pre>