I have a textfield in an uiAlertController, and I would like to retrieve the content inside to build an object. I wrote this following code :
let alertController = UIAlertController(title: "Ajouter une description", message: "De quoi sagit il ?", preferredStyle: UIAlertControllerStyle.alert)
alertController.addTextField { (textField : UITextField) -> Void in
textField.placeholder = "Description"
self.theDescription = textField.text!
}
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default) { (result : UIAlertAction) -> Void in
self.createArtWithDescription(description: self.theDescription)
}
alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)
//
}
To build my object, I have another function "createArtWithDescription", but inside I can't retrieve the content of the uiAlertController textfield.
Thanks by advance