I have a UISwitch that I want to control a boolean value in a function I wrote. I looked in the UISwitch Type Reference and it listed the property
UISwitch
No need for extra boolean. use this :
if mySwitch.isOn { // do something } else { // do something else }
this is an always up to date boolean for switch state, so NO NEED to create your own variable.