Skip to content

Instantly share code, notes, and snippets.

@KrauserHuang
Created December 29, 2020 04:38
Show Gist options
  • Save KrauserHuang/d4330fe771cb566164672255556712e6 to your computer and use it in GitHub Desktop.
Save KrauserHuang/d4330fe771cb566164672255556712e6 to your computer and use it in GitHub Desktop.
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
if ageTextField.text?.isEmpty == false,
heightTextField.text?.isEmpty == false,
weightTextField.text?.isEmpty == false,
activityButtonText.titleLabel?.text?.isEmpty == false {
return true
} else {
let controller = UIAlertController(title: "Please fill in all the blank", message: "You need to fill all the blank to calculate your BMR & TDEE", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
controller.addAction(okAction)
present(controller, animated: true, completion: nil)
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment