override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool { if identifier == "showResult" { guard self.nameText.text != "" else { let alertController = UIAlertController(title: "Error", message: "Please enter your name", preferredStye: alert) let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil) alertController.addAction(defaultAction) self.present(alertController, animated: true, completion: nil) return false } return true } return true }