title: Automatic Login in IOS Swift
body: <p>I have a login interface as below in an app that I am working on that is working with parse as database. I want the app to log in automatically for the user in the next time when a users opens the app again unless the user clicks the log-out button to remove the password (which is seen as secure view). How can I do this? </p>
  
  <pre><code>@IBAction func signInBtn(sender: AnyObject) {
  
      PFUser.logInWithUsernameInBackground(emailTxt.text, password: passwordTxt.text) {
          (user:PFUser?, error:NSError?) -&gt; Void in
  
          if error == nil {
  
              println("logIn")
              self.performSegueWithIdentifier("gotoMainVCFromSigninVC", sender: self)
  
          } else {
  
              let alertView = UIAlertController(title: "Wrong username or password", message: "Please try again", preferredStyle: .Alert)
              alertView.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil))
              self.presentViewController(alertView, animated: true, completion: nil)
  
          }
  
      }
  
  }
  </code></pre>