title: Swift - Toggle UIButton title when selected
body: <p>I'm looking to implement a button that can be used as a tickbox and enablers the user to toggle the tickbox in an on/off fashion (unticked/ticked).  Currently I've set up my button using the attributes inspector including the 'Title' as "X" and the 'Text Color' is red.</p>
  
  <p>Once loaded the button appears a red "X", once tapped it turns to a green tick.</p>
  
  <p><strong>My question is...</strong> how do you enable the button to be tapped again to revert back to the red X (it's original state), an continue in a loop whenever tapped?</p>
  
  <pre><code>    @IBAction func check2(_ sender: UIButton) {
       sender.setTitle("✓", for: .normal)
      sender.setTitleColor(UIColor.green, for: UIControlState.normal)
  }
  </code></pre>
  
  <p>Thank you</p>