title: How to add TextField to UIAlertController in Swift
body: <p>I am trying to show a <code>UIAlertController</code> with a <code>UITextView</code>. When I add the line:</p>
  
  <pre><code>    //Add text field
      alertController.addTextFieldWithConfigurationHandler { (textField) -&gt; Void in
      }        
  </code></pre>
  
  <p>I get a <code>Runtime</code> error: </p>
  
  <blockquote>
    <p>fatal error: unexpectedly found nil while unwrapping an Optional value</p>
  </blockquote>
  
  <pre><code>    let alertController: UIAlertController = UIAlertController(title: "Find image", message: "Search for image", preferredStyle: .Alert)
  
      //cancel button
      let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -&gt; Void in
          //cancel code
      }
      alertController.addAction(cancelAction)
  
      //Create an optional action
      let nextAction: UIAlertAction = UIAlertAction(title: "Search", style: .Default) { action -&gt; Void in
          let text = (alertController.textFields?.first as! UITextField).text
          println("You entered \(text)")
      }
      alertController.addAction(nextAction)
  
      //Add text field
      alertController.addTextFieldWithConfigurationHandler { (textField) -&gt; Void in
          textField.textColor = UIColor.greenColor()
      }
      //Present the AlertController
      presentViewController(alertController, animated: true, completion: nil)
  </code></pre>
  
  <p>This is presented inside my <code>ViewController</code> via an <code>IBAction</code>.</p>
  
  <p>I have downloaded the code from <a href="http://sourcefreeze.com/uialertcontroller-ios-8-using-swift/" rel="noreferrer">here</a> and it works fine. I copied and pasted that method into my code and it breaks. The presence of <strong>self</strong> on the last line has no impact.</p>