title: Swift alert view with OK and Cancel: which button tapped?
body: <p>I have an alert view in Xcode written in Swift and I'd like to determine which button the user selected (it is a confirmation dialog) to do nothing or to execute something.</p>
  
  <p>Currently I have:</p>
  
  <pre><code>@IBAction func pushedRefresh(sender: AnyObject) {
      var refreshAlert = UIAlertView()
      refreshAlert.title = "Refresh?"
      refreshAlert.message = "All data will be lost."
      refreshAlert.addButtonWithTitle("Cancel")
      refreshAlert.addButtonWithTitle("OK")
      refreshAlert.show()
  }
  </code></pre>
  
  <p>I'm probably using the buttons wrong, please do correct me since this is all new for me.</p>