title: Firebase & Xcode 8: Add "Remember Me" Check Box to Login & Insert Activity Indicator View
body: <p>I am not very familiar with Firebase and I want to create a "Remember Me" Checkbox in Xcode 8 so that a user can use that feature to login if he/she checks the "Remember Me" checkbox.</p>
  
  <p>I would also like to insert an Activity Indicator View after a user taps "Login" but I failed. That little spinner thing just keeps spinning and stays on the screen all the time. I want to dim the screen and have the spinner spin after a user taps "login".</p>
  
  <p>Here are my codes.</p>
  
  <pre><code>import UIKit
  import Firebase
  
  class LoginViewController: UIViewController {
  
      var imageView: UIImageView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          imageView = UIImageView(frame: view.bounds)
          imageView.contentMode = .scaleAspectFill
          imageView.clipsToBounds = true
          imageView.image = #imageLiteral(resourceName: "background")
          imageView.center = view.center
          view.addSubview(imageView)
          self.view.sendSubview(toBack: imageView)
  
      }
  
      //Outlets
      @IBOutlet weak var emailTextField: UITextField!
      @IBOutlet weak var passwordTextField: UITextField!
  
  
      //Login Action
      @IBAction func loginAction(_ sender: AnyObject) {
          if self.emailTextField.text == "" || self.passwordTextField.text == "" {
  
              //Alert to tell the user that there was an error because they didn't fill anything in the textfields because they didn't fill anything in
  
              let alertController = UIAlertController(title: "Error", message: "Please enter an email and password.", preferredStyle: .alert)
  
              let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
              alertController.addAction(defaultAction)
  
              self.present(alertController, animated: true, completion: nil)
  
          } else {
  
              Auth.auth().signIn(withEmail: self.emailTextField.text!, password: self.passwordTextField.text!) { (user, error) in
  
                  if error == nil {
  
                      //Print into the console if successfully logged in
                      print("You have successfully logged in")
  
                      //Go to the HomeViewController if the login is sucessful
                      let vc = self.storyboard?.instantiateViewController(withIdentifier: "Home")
                      self.present(vc!, animated: true, completion: nil)
  
                  } else {
  
                      //Tells the user that there is an error and then gets firebase to tell them the error
                      let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
  
                      let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
                      alertController.addAction(defaultAction)
  
                      self.present(alertController, animated: true, completion: nil)
                  }
              }
          }
      }
  </code></pre>