title: Conditionally display a ViewController Xcode - iOS App
body: <p>I'm very new with Xcode and I would like to find a way to display something different if the user is logged in to my app or if he is not.</p>
  
  <p>I have a tabbed application. The authenticated user should access directly to the tabbed views. But the user that is not should land on an authentication page.</p>
  
  <p>My guess is that I need to have something like :</p>
  
  <pre><code>if (user) {
      // Do stuff if user logged in.
  } else {
      // Display the authentication page.
  }
  </code></pre>
  
  <p>But I have no idea on how to accomplish that and I didn't find anything about that. I'm looking for hints.</p>
  
  <p>EDIT:</p>
  
  <p>My question is not about how I could know if a user is authenticated or not, but how I can display a specific page in a case and an other page in an other case.</p>
  
  <p>Where and how should I write the code, knowing that I already know how to distinguish an authenticated user : </p>
  
  <pre><code>   if (user is authenticated) {
  // SHOW FIRSTVIEWCONTROLLER
     } else {
  // SHOW SECONDVIEWCONTROLLER
    }
  </code></pre>
  
  <p>EDIT 2:</p>
  
  <p>I have a tabbed application, with 3 tabs and a mainstoryboard (no xibs). I want to add a page, before the tabbed pages, where the user can authenticate.</p>
  
  <p>So I need to display this viewController on a condition. If the user is not authenticated I show the page, if he is I show directly the tabbed pages.</p>
  
  <p>Again, I don't want to know how to distinguish if the user is authenticated or not, I just wan't to know how I can display a ViewController if a condition is fulfilled.</p>