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.