title: How do i access the textField in my alertView? Trying to see if password matches current user. parse/swift
body: <p>I am trying to make an alert appear when the user tries to click on the logOut button. Then the user will be asked to re-type their password in order to logout. </p>
  
  <p>Here is my code. </p>
  
  <pre><code>     @IBAction func logOut(sender: AnyObject) {
  
          let alert = UIAlertController(title: "Are You Sure You Want To Log Out?", message: "Please Enter Your Password", preferredStyle: UIAlertControllerStyle.Alert)
  
          alert.addTextFieldWithConfigurationHandler { (textField) -&gt; Void in
          }
  
      alert.addAction(UIAlertAction(title: "Log Out", style: UIAlertActionStyle.Default, handler: { (action) -&gt; Void in
          let textF = alert.textFields![0] as UITextField
  
          if textF.text! != PFUser.currentUser()?.password {
              print("Cannot Log Out")
  
          } else if textF.text! == PFUser.currentUser()?.password! {
              PFUser.logOut()
              let currentUser = PFUser.currentUser()
              print(currentUser)
          }
      }))
  
      alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: { (action) -&gt; Void in
          if action == true {
          self.dismissViewControllerAnimated(false, completion: nil)
          }}))
  
  self.presentViewController(alert, animated: true, completion: nil)
  
  }
  </code></pre>
  
  <p>When i click cancel on the alertView it closes the alert and the user is not logged out. <strong>Perfect!</strong></p>
  
  <p>If i type in random letters my debugger console prints "Cannot logout"(which i will change later for another alertview saying incorrect password) <strong>Perfect!</strong></p>
  
  <p><strong>The Issue is</strong>
  Even if i type the correct password it is saying "cannot logout" which to me means that i am not accessing:        </p>
  
  <pre><code>    PFUser.CurrentUser.password
  </code></pre>
  
  <p>Any views on fixing this? - Thank you.</p>