title: ViewController segue and login
body: <p>I'm new to Swift (and programming in general). I'm having some difficulties in Xcode with the login feature. What I want is that the user should be logged in if no errors was returned and the user should be sent to another controller. I've read some of the documentation from Apple and the <code>performSegueWithIdentifier</code> (and of course some questions asked here), but it still does not work when I use a segue with <code>push</code> or <code>modal</code> that are given an identifier. Either the app crashes, or the user is sent to my <code>UITabBarController</code> even if the credentials was incorrect. </p>
  
  <p>This is my LogInViewController.swift:</p>
  
  <pre><code>@IBAction func loginAction(sender: AnyObject)
  {
      if self.emailField.text == "" || self.passwordField.text == ""
      {
          let alertController = UIAlertController(title: "Oops!", message: "Please enter an email and password.", preferredStyle: .Alert)
  
          let defaultAction = UIAlertAction(title: "OK", style: .Cancel, handler: nil)
          alertController.addAction(defaultAction)
  
          self.presentViewController(alertController, animated: true, completion: nil)
      }
      else
      {
          FIRAuth.auth()?.signInWithEmail(self.emailField.text!, password: self.passwordField.text!) { (user, error) in
  
              if error == nil
              {
                  self.emailField.text = ""
                  self.passwordField.text = ""
              }
              else
              {
                  let alertController = UIAlertController(title: "Oops!", message: error?.localizedDescription, preferredStyle: .Alert)
  
                let defaultAction = UIAlertAction(title: "OK", style: .Cancel, handler: nil)
                  alertController.addAction(defaultAction)
  
                  self.presentViewController(alertController, animated: true, completion: nil)
              }
               // User Logged in
                  self.performSegueWithIdentifier("LoggedIn", sender: self)
          }
      }
  }
  </code></pre>
  
  <p>The error I get in the console:</p>
  
  <blockquote>
    <p>2016-09-04 14:55:30.019 DrinkApp[37777:1006336] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'LoggedIn'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'</p>
  </blockquote>