I currently have a UIButton that changes from red to green when selected. How can I implement the reverse, so that it goes back to the original state when selected again? Below is my current code:
@IBAction func button1press(_ sender: AnyObject) {
(sender as! UIButton).backgroundColor = UIColor.green
}