Instance Method

setOn(_:animated:)

Set the state of the switch to On or Off, optionally animating the transition.

Declaration

func setOn(_ on: Bool, animated: Bool)

Parameters

on

true if the switch should be turned to the On position; false if it should be turned to the Off position. If the switch is already in the designated position, nothing happens.

animated

true to animate the “flipping” of the switch; otherwise false.

Discussion

Setting the switch to either position does not result in an action message being sent.

See Also

Setting the Off/On State

var isOn: Bool

A Boolean value that determines the off/on state of the switch.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software