title: Right way or event to choose what view load in swift
body: <p>I'm working in an app that logs in an user if there isn't another user already logged in at launch time. This way the first view to appear should be the Login View. But in the case there is a logged user already, the first view appearing should be the main menu. Im handling this with the viewWillAppear function and it's working, but I don't know if this is the correct approach or how it should be handle in this situations. </p>
  
  <p>Here is my code. My first view is MainMenuVC in which I control if there is a logged user or not, then I choose if stay in main menu view or push my login view.</p>
  
  <pre><code>class MainMenuVC: UIViewController {
  
  
  override func viewWillAppear(animated: Bool) {
      if (UserMgr.users.count == 0){
          var vc1:LoginVC = self.storyboard?.instantiateViewControllerWithIdentifier("LoginView") as LoginVC
          self.navigationController?.pushViewController(vc1, animated: false)
      }
      else
      {
          //I do nothing so this view is loaded
      }
  
  
  }
  </code></pre>
  
  <p>I don't know if i should use another ViewController and implement the function loadView() to decide what view load, but the problem is make that view work with the story board and my navigation controller. 
  Any suggestions?</p>