title: Reset or change button title at the end of countdown
body: <p>I'm building an app for iPhone/iPad. My app has a countdown timer. The countdown start button is labled "Start", and it switches to "Running" when the button is pressed. When the countdown has reached 00:00, I want the button title to reset itself to "Start" or change it to "Restart", so that the user can start all over again.</p>
  
  <p>I'm new to Swift, so I hope someone can help with this. Here's my code:</p>
  
  <pre><code>import Foundation
  import UIKit
  import AVFoundation
  
  
  class VC11 : UIViewController {
  
  
      @IBOutlet weak var timerLabel: UILabel!
  
  
  
      var timer = NSTimer()
      var count = 240
      var timerRunning = false
      var audioPlayer = AVAudioPlayer()
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
  
              func nextPage(sender:UISwipeGestureRecognizer) {
                  switch sender.direction {
  
                  case UISwipeGestureRecognizerDirection.Left:
                      print("SWIPED LEFT")
                      self.performSegueWithIdentifier("seg11", sender: nil)
                  default:
                      break
  
                  }
  
  
                  var leftSwipe = UISwipeGestureRecognizer (target: self, action: Selector("nextPage"))
                  var rightSwipe = UISwipeGestureRecognizer (target: self, action: Selector("nextPage"))
  
                  leftSwipe.direction = .Left
                  rightSwipe.direction = .Right
  
                  view.addGestureRecognizer(leftSwipe)
                  view.addGestureRecognizer(rightSwipe)
              }
  
  
          }
  
  
  
      func updateTime() {
          count--
  
              let seconds = count % 60
              let minutes = (count / 60) % 60
              let hours = count / 3600
              let strHours = hours &gt; 9 ? String(hours) : "0" + String(hours)
              let strMinutes = minutes &gt; 9 ? String(minutes) : "0" + String(minutes)
              let strSeconds = seconds &gt; 9 ? String(seconds) : "0" + String(seconds)
              if hours &gt; 0 {
                  timerLabel.text = "\(strHours):\(strMinutes):\(strSeconds)"
              }
              else {
                  timerLabel.text = "\(strMinutes):\(strSeconds)"
  
          }
          stopTimer()
  
  
             }
    @IBAction func startTimer(sender: AnyObject) {
      timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("updateTime"), userInfo: nil, repeats: true)
  
      sender.setTitle("Running...", forState: .Normal)
  
         }
  
  
      func stopTimer()
  
      {
  
          if count == 0 {
              timer.invalidate()
              timerRunning = false
              timerLabel.text = "04:00"
              playSound()
              count = 240
  
          }
  
  
      }
  
  
  
  
      func playSound() {
  
      var soundPath = NSBundle.mainBundle().pathForResource("Metal_Gong", ofType: "wav")
      var soundURL = NSURL.fileURLWithPath(soundPath!)
  
  
          self.audioPlayer = AVAudioPlayer(contentsOfURL: soundURL, error: nil)
          self.audioPlayer.play()
      }
  
  
  }
  </code></pre>