title: Where to put user logged in vs user logged out logic?
body: <p>I know I'm doing this wrong.</p>
  
  <p>When my app opens, I need to tell whether the user is logged in or logged out (and depending on that, open a different view controller).</p>
  
  <p>My solution is in this image below.</p>
  
  <p><a href="https://i.stack.imgur.com/Fz4s1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fz4s1.png" alt="enter image description here"></a></p>
  
  <p>I know this is wrong (it's just an empty View Controller for one function) but I don't know where else I could put this logic.</p>
  
  <p>On top of this, I also need to know whether the user is a paid customer or a free customer (each gets a different home page).
  How do I check this too without building an entire new View Controller just for that purpose?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>One comment asked me to paste my code, so here it is:
  `
  import UIKit
  import Firebase</p>
  
  <p>class CheckIfLoggedInViewController: UIViewController {</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      // Do any additional setup after loading the view.
  
      Auth.auth().addStateDidChangeListener { auth, user in
          if user != nil {
              // User is signed in. Show home screen
              self.performSegue(withIdentifier: "goToLoggedIn", sender: self)
          } else {
              // No User is signed in. Show user the login screen
              self.performSegue(withIdentifier: "goToLoggedOut", sender: self)
          }
      }
  
  }
  </code></pre>
  
  <p>`</p>