When I add one or more textField into UIAlertController the app freezes, once I deleted the textFields it works perfectly fine.
Xcode 11 beta 5 running on Mojave 10.14.6
@IBAction func addRecipeBtnHandler(_ sender: Any) {
let alert = UIAlertController(title: "Add new recipe", message: nil, preferredStyle: .alert)
alert.addTextField { textField in
textField.placeholder = "title"
}
alert.addTextField { textField in
textField.placeholder = "description"
}
let action = UIAlertAction(title: "Add", style: .default) { alertAction in
let title = alert.textFields?.first?.text ?? ""
let description = alert.textFields?.last?.text ?? ""
let recipe = Recipe(title: title, description: description)
self.recipes.append(recipe)
self.updateSnapshot()
}
alert.addAction(action)
DispatchQueue.main.async {
self.present(alert, animated: true)
}
}