title: swift ios cant remove old modal viewcontrollers from stack
body: <p>In my app I am making the account page the new root VC when a user logs in.</p>
  
  <p>It looks like this:</p>
  
  <p>Navigation controller -> table view -> <strong>menu(modal segue) -> login screen(modal segue)</strong> -> account page</p>
  
  <p>When transitioning from login to account I am using:</p>
  
  <pre><code>let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
  
  let vc = storyboard.instantiateViewControllerWithIdentifier("testVc")
  
  let navigationController = self.view.window?.rootViewController as! UINavigationController
  navigationController.setViewControllers([vc], animated: true)
  </code></pre>
  
  <p>This makes the account page the new root VC. But the only problem is that once is shows up both the menu and login form is still visible ontop of the screen.</p>
  
  <p>So how do I clear two old VC's shown as modal?</p>
  
  <p><strong>Update got it to work using:</strong></p>
  
  <pre><code>  @IBAction func loginButtonDidTouch(sender: AnyObject) {
  
          let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
  
          let vc = storyboard.instantiateViewControllerWithIdentifier("testVc")
  
          let navigationController = self.view.window?.rootViewController as! UINavigationController
  
          self.presentingViewController!.presentingViewController!.dismissViewControllerAnimated(false) { () -&gt; Void in
  
          navigationController.setViewControllers([vc], animated: true)
  
          }
  
      }
  </code></pre>
  
  <p>But I dont know if this is the right way to do it?</p>