@IBAction func switch(_ sender: Any) { if ((sender as AnyObject).isOn == true) { //Yes } else { //No } }