title: enable and disable a button Xcode 8
body: <p>I am trying to create a way to disable a <code>Button</code>. This is an app I made that is an egg timer, and I run into one bug; when I press the play button multiple times the timer speeds up and I can't get it to stop. I want to create a disable feature, but everything I've seen on the forum says to use. <code>enable = true</code>. When I use this Xcode says that it isn't valid. What is the proper code for enabling and disabling a button in Xcode 8?    </p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      var timer = Timer()
      var myCount = 210
      var button = 0
  
      func processTimer() {
  
          //what happens every second
  
          counter()
  
      }
  
      func startTimer() {
          timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ViewController.processTimer), userInfo: nil, repeats: true)
          button = 1
      }
  
      func pauseTimer() {
          timer.invalidate()
          button = 0
      }
  
      func resetTimer(){
          timer.invalidate()
          myCount = 210
          countdown.text = "\(myCount)"
          button = 0
      }
  
      func counter() {
          myCount -= 1
          if myCount &gt; 0 {
              countdown.text = "\(myCount)"
          } else {
              countdown.text = "0"
              timer.invalidate()
          }
      }
  
      func add(){
          myCount += 10
          if myCount &gt; 0 {
              countdown.text = "\(myCount)"
          } else {
              countdown.text = "0"
          }
      }
  
      func sub(){
          myCount -= 10
          if myCount &gt; 0 {
              countdown.text = "\(myCount)"
          } else {
              countdown.text = "0"
          }
      }
  
  
  
  
  
  
      // timer countdown
      @IBOutlet var countdown: UILabel!
  
      // pause button
      @IBAction func pauseButton(_ sender: AnyObject) {
          pauseTimer()
          print("Timer Paused")
      }
  
  
      //play button
      @IBAction func playButton(_ sender: AnyObject) {
          startTimer()
          print("Timer started")
      }
  
  
      // -10 seconds
      @IBAction func minusTen(_ sender: AnyObject) {
          sub()
  
  
  
      }
      // reset timer to 290
      @IBAction func resetButton(_ sender: AnyObject) {
          resetTimer()
          print("Timer Reset")
      }
  
  
  
  
  
  
      // +10 seconds
      @IBAction func addTen(_ sender: AnyObject) {
          add()
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
          countdown.text = "\(myCount)"
  
          if button == 0{
              playButton.enabled = true
          }
  
  
  
  
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
  }
  </code></pre>