Skip to content

Instantly share code, notes, and snippets.

@halilozel1903
Last active June 26, 2018 07:57
Show Gist options
  • Save halilozel1903/c847bbea7b4121e9bb1c3a3bd7244be3 to your computer and use it in GitHub Desktop.
Save halilozel1903/c847bbea7b4121e9bb1c3a3bd7244be3 to your computer and use it in GitHub Desktop.
if usernameTxt.text == "" && passwordTxt.text == "" {
let alert = UIAlertController(title: "Alert", message: "Username and Password is empty", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(okButton)
self.present(alert, animated: true, completion: nil)
}
else if passwordTxt.text == ""{
let alert = UIAlertController(title: "Alert", message: "Password is empty", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(okButton)
self.present(alert, animated: true, completion: nil)
}
else if usernameTxt.text == ""{
let alert = UIAlertController(title: "Alert", message: "Username is empty", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(okButton)
self.present(alert, animated: true, completion: nil)
}
else if passwordTxt.text != passwordAgainTxt.text{
let alert = UIAlertController(title: "Alert", message: "Passwords are not matching", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(okButton)
self.present(alert, animated: true, completion: nil)
}
else{
let alert = UIAlertController(title: "Alert", message: "User Signed Up", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alert.addAction(okButton)
self.present(alert, animated: true, completion: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment