I am trying to switch to another ViewController once I click 'OK' on the AlertController. Currently when I click 'OK' it stays on the current ViewController. How can this be done? thanks.
This code is presented in ViewController1 and I want to change to ViewController4 once I have clicked 'OK' when the AlertController appears.
Code Below:
@IBAction func submitTapped(sender: AnyObject) {
print("Validating...")
validator.validate(self)
Button1.hidden = false
}
// MARK: ValidationDelegate Methods
func validationSuccessful() {
print("Validation Success!")
let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertControllerStyle.Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: {action in ViewController4))
alert.addAction(defaultAction) - Error Code // Variable used within its own initial value
self.presentViewController(alert, animated: true, completion: nil)
} - Error Code //Expected ‘,’ separator