SugarmanZhu

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

Close

Q: Switch in Xcode

  • All replies
  • Helpful answers