title: How do you use an alert to prompt for text in iOS with Swift?
body: <pre><code>func addPitcher(sender: UIBarButtonItem) {
      var alert = UIAlertController(title: "New Pitcher", message: "Enter Name", preferredStyle: UIAlertControllerStyle.Alert)
      alert.addAction(UIAlertAction(title: "Finish", style: UIAlertActionStyle.Default, handler: nil))
      alert.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
          textField.placeholder = "Name"
          textField.secureTextEntry = false
      })
      self.presentViewController(alert, animated: true, completion: nil)
      let newName : String = alert.textFields[0] as String
      println(newName)
  }
  </code></pre>
  
  <p>This is the function in which we try and create an alert to prompt for a name. We get "EXC_BAD_INSTRUCTION" error at the <code>alert.addTextFieldWithConfigurationHandler({(textField: UITextField!) in</code> line.</p>
  
  <p>How do we fix this error, or more importantly, how do we retrieve the text from the field? Thank you for all help. </p>