Is it possible to connect a function to an UIAlertAction
?
So after a user clicks the OK button it performs an action? Isn't this what the handler parameter does?
let alert: UIAlertController = UIAlertController(title: "Email already registered", message: "Please enter a different email", preferredStyle: .alert)
let okButton = UIAlertAction(title: "OK", style: .default, handler: backToLogin())
alert.addAction(okButton)
self.presentViewController(alert, animated: true, completion: nil)
...
func backToLogin() {
self.performSegueWithIdentifier("toLoginPage", sender: self)
}