0
Can someone help me
What is the correct way in Swift 2? asks to remove "Let okAction", but then I lose the reference and the alert is no button.
Let okAction = Uialertaction(title: "OK", style: Uialertactionstyle.Default, Handler: nil)
Full code to facilitate:
@IBAction func singUpButtonTapped(sender: AnyObject) {
let userEmail = userEmailAddressTextField.text
let userPassword = userPasswordTextField.text
let userPasswordRepeat = userPasswordRepeatTextField.text
let userFirstName = userFirstNameTextField.text
let userLastName = userLastNameTextField.text
if( userPassword != userPasswordRepeat) {
displayAlertMessage("Passwords do not match")
return
}
if(userEmail!.isEmpty || userPassword!.isEmpty || userFirstName!.isEmpty || userLastName!.isEmpty )
{
displayAlertMessage("Passwords do not match")
return
}
}
func displayAlertMessage(userMessage:String)
{
let myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert);
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil)
self.presentViewController(myAlert, animated: true, completion: nil)
}