Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
UIAlertController Example
@IBAction func logSolution(sender: UIBarButtonItem) {
let alertController = UIAlertController(title: "Log Solution",
message: "Please enter your solution.",
preferredStyle: .alert)
alertController.addTextField(configurationHandler: { textField in
textField.autocorrectionType = .no
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel))
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in
guard let solution = alertController.textFields?[0].text else {
// In der Konstante solution steht das Lösungswort, das vom Benutzer eingegeben wurde.
// TODO: Dieses Wort muss jetzt ähnlich wie beim Metalldetektor im Logbuch eingetragen werden.
present(alertController, animated: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.