Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func checkPassword() {
- let alert = UIAlertController(title: "Password", message: "What is your password", preferredStyle: .alert)
- let authenticateAction = UIAlertAction(title: "Authenticate", style: .default) { (action) in
- guard let textfield = alert.textFields?.first,
- let password = textfield.text else {
- return
- }
- if (password == "alice so cute") {
- self.infoLabel.text = "Password successful"
- self.performSegue(withIdentifier: "secret", sender: self)
- } else {
- self.infoLabel.text = "incorrect password"
- }
- }
- let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
- alert.addTextField(configurationHandler: nil)
- alert.addAction(cancelAction)
- alert.addAction(authenticateAction)
- present(alert,animated: true)
- }
Add Comment
Please, Sign In to add comment