title: segue back and forth between viewcontrollers
body: <p>I'm implementing a single sign on in my app (user needs to login only once).</p>
  
  <p>but the user can sign out if he wants.</p>
  
  <p>i will explain my problem with a use case flow.</p>
  
  <p><strong>FLOW:</strong></p>
  
  <ol>
  <li>loginViewController -> user presses login -> i segue to appNavigationController (HomePageViewController is root viewController)</li>
  <li>HomePageViewController -> user signs out of app -> i segue back to login page</li>
  <li>user sign's back in.</li>
  </ol>
  
  <p>Now I have a problem.</p>
  
  <p>I get an error:</p>
  
  <pre><code>Warning: Attempt to present &lt;app.loginViewController: 0x15d559f00&gt; on &lt;app.homeViewController: 0x15d625660&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>And I don't know if this is the problem but the <code>navigationController</code> is saving the first <code>homeViewController</code> and its not emptying the stack 
  I tried to pop the <code>homeViewController</code> in <code>viewDidDisappear</code>
  it didn't work the stack still saves the first <code>homeViewController</code> </p>
  
  <p>Any suggestions?</p>