With additional logical values, it works a little differently, you need to explicitly check if the value is nil. That is why your After: works, not your Before:
//now this is checking if your values are nil (empty) rather than not nil //before if a user had valid fields, it would say that "All fields are required" //now, this will work if(userEmail == nil || userPassword == nil || userRepeatPassword == nil){ displayMyAlertMessage("All fields are required") } else if(userPassword != userRepeatPassword){ displayMyAlertMessage("Passwords do not match.") } else { //success //perform segue here to correct screen }
There are several options for how you can execute segue, I will choose the presentViewController method, see below on how to integrate it. ...
else { //success //perform segue here to correct screen presentViewController(yourMainScreenViewController, animated: true, completion: nil) }
You can also use performSegueWithIdentifier ("yourMainScreenIdentifier", sender: zero) if you are not using the presentViewController method, for example:
else { //success //perform segue here to correct screen performSegueWithIdentifier("yourMainScreenIdentifier", sender: nil) }
I will add that I am assuming your displayMyAlertMessage :
func displayMyAlertMessage(alert: String) { println(alert) }
source share