UIAlertController --> Used to update variable?

I'm new to Xcode and Swift. I'm trying to set up an alert (which I have done - code below). I was wondering if someone can help me out. What I would like to do is reset two different variables to 0 if "Yes" is tapped.

Your help is greatly apprecieated.

@IBAction func showAlert() {
    let alertController = UIAlertController(title: "Confirm Point Reset", message: "Are You Sure?", preferredStyle: .Alert)

    let firstAction = UIAlertAction(title: "Yes", style: .Default, handler: nil)

    let secondAction = UIAlertAction(title: "No", style: .Default, handler: nil)


    presentViewController(alertController, animated: true, completion: nil)



You need to add the completion handler and update the values in that closure. The completion handler is the code that is executed when the action occurs (when the button is pressed).

let firstAction = UIAlertAction(title: "Yes", style: .Default) { action in
    self.foo = 0

Need Your Help

Conversion failed when converting date and/or time from a character string

sql asp.net sql-server datetime

This code was working yesterday but not now. I haven't changed anything... Why is that and how can i fix it?