1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
if usernameText.text == "" { makeAlert(titleInput: "Error", messageInput: "Username not found!") } else if passwordText.text == "" { makeAlert(titleInput: "Error", messageInput: "Password not found!") } else if passwordText.text != password2Text.text { makeAlert(titleInput: "Error", messageInput: "Passwords do no match") } else { makeAlert(titleInput: "Success", messageInput: "User OK") } } func makeAlert(titleInput: String, messageInput:String) { let alert = UIAlertController(title: titleInput, message: messageInput, preferredStyle: UIAlertController.Style.alert) let okButton = UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil) alert.addAction(okButton) self.present(alert, animated: true, completion: nil) } |