title: Why isn't my user alert code in Swift working as intended
body: <p>I have a reset button in my app. I've coded it so that if users tap on this to reset the app they are presented with a user alert first. This alert provides info and offers two choices: (1) Cancel, (2) Continue.</p>
  
  <p>The idea is that if they tap on Cancel the game won't reset. But if they tap on Continue, the game will reset.</p>
  
  <p><strong>ISSUE 1</strong></p>
  
  <p>At present, when the user taps on the reset button, the game is reset immediately <strong>before</strong> the alert displays. After the alert does display, if they tap 'Cancel' nothing more happens, but if they tap 'Continue' the game is reset again! </p>
  
  <p>So, on the face of it the alert buttons work as they should - it's just that tapping the Reset icon already actions the reset before the alert appears.</p>
  
  <p><strong>ISSUE 2</strong></p>
  
  <p>My alert code caters for iOS 8 and above users as well as pre-iOS 8 users. How do I alter this part of the code to also offer pre-iOS 8 users the ability to either 'Cancel' or 'Continue'? At present they just get a 'Continue' option.</p>
  
  <p>My code for the alerts is below:</p>
  
  <pre><code>@IBAction func buttonResetGame(sender: UIButton) {
  
      if #available(iOS 8.0, *) {
          let alert = UIAlertController(title: "Info", message: "This will reset your score and questions.", preferredStyle: UIAlertControllerStyle.Alert)
  
          // add the Continue button and action
          alert.addAction(UIAlertAction(title: "Continue", style: UIAlertActionStyle.Destructive, handler: {action in
  
              // do this...
              self.ResetGame()
          }))
  
          // add the Cancel button and action
          alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
  
          self.presentViewController(alert, animated: true, completion: nil)
  
  
      }else{
          // For pre-iOS 8 users
          let alert = UIAlertView()
          alert.title = "Info"
          alert.message = "This will reset your score and questions."
          alert.addButtonWithTitle("Continue")
          alert.show()
      }
      ResetGame()
  
  }
  </code></pre>
  
  <p>If it's relevant, my code for resetting the game is below:</p>
  
  <pre><code>func ResetGame() {
      PlaySoundReset()
      score = 0
      totalquestionsasked = 0
      SaveScore()
      LoadScore()
  }
  </code></pre>