As Apple\'s document write, UISwitch
\'s function setOn(on: Bool, animated: Bool)
does not send action. It works fine before iOS 10, but it will send ac
DispatchQueue.main.async {
sender.setOn(flag, animated: animated)
}
it works for me in Xcode 8.
but call UISwitch.setOn(_:animated:)
directly on main thread doesn't work.
thanks to @codiction:
UISwitch.setOn(_:animated:)
can be called direclty on main thread, but can't be called directly in UISwitch ValueChanged action on iOS 10.