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
Succinctness, even parsimony, is important in coding style. Try this:
@IBAction func switchValueChanged (sender: UISwitch) {
advice.isInProduction = sender.on
print ("It's \(advice.isInProduction)!")
}
In your original code, you likely crashed because acsessabilitySwitch or advice are unbound (have values of nil).
[Updated - replaced println with print]