Note that there are some explanatory texts on larger screens.

plurals
  1. POConditionally display a ViewController Xcode - iOS App
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload