title: ios swift - dismiss root view controller of navigation controller
body: <p>I'm opening a navigation controller from a button click of my main view controller. </p>
  
  <p>I programatically created a left bar button item on the navigation controller which I want to dismiss the nav controller and go back to my main controller.</p>
  
  <p>I'm essentially going back on the root view controller of the navigation controller.</p>
  
  <p>I've tried </p>
  
  <pre><code>navigationController?.dismissViewControllerAnimated(true, completion: nil)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>self.dismissViewControllerAnimated(true, completion: nil)
  </code></pre>
  
  <p>and get an NSException on both.</p>
  
  <p>Please advise. </p>