Q: Switch in Xcode
Below is my code for the switch but it didn't work.
It says Value of type '(AnyObject) -> ()' has no member 'isOn'
@IBAction func mySwitch(_ sender: AnyObject) {
if (mySwitch.isOn)
{//action when switch is on}
else
{//action when switch is off}
}
MacBook Pro, iOS 10, Xcode
Posted on Sep 27, 2016 5:17 AM
by Keith Barkley,Solvedanswer
When is mySwitch called?
I think you need an outlet, not an action.
Posted on Sep 27, 2016 9:54 AM