connect a button to a switch swift code example
Example: switch button swift 5
@IBAction func switch(_ sender: Any) {
if ((sender as AnyObject).isOn == true) {
//Yes
} else {
//No
}
}
@IBAction func switch(_ sender: Any) {
if ((sender as AnyObject).isOn == true) {
//Yes
} else {
//No
}
}