title: Multiple checkbox buttons in swift 3
body: <p>I have working code for a checkbox in swift, but the project I'm looking to build has about 50 or so checkboxes. In keeping with the goal of less code is best I'm wondering if there's a better way to write it all out than to just copy and paste. I tried linking multiple buttons to one iboutlet but I guess that was not the way to go seeing as how a different button would register selected then the one tapped.</p>
  
  <p>working code:</p>
  
  <pre><code>   @IBOutlet weak var buttonOne: UIButton!
  
  var isButtonClicked: Bool!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      isButtonClicked = false
  }
  
  @IBAction func buttonClicked(_ sender: UIButton) {
  
      if isButtonClicked == true {
          isButtonClicked = false
      }
      else {
          isButtonClicked = true
      }
  
      if isButtonClicked == true {
          buttonOne.setImage(#imageLiteral(resourceName: "ButtonClicked"), for: .normal)
      }
      else {
          buttonOne.setImage(#imageLiteral(resourceName: "ButtonUnclicked"), for: .normal)
      }
  }
  </code></pre>