setOn(_:)
Sets the state of the switch to the specified value.
Declaration
func setOn(_ on: Bool)Parameters
- on:
A Boolean value indicating whether the switch should be set to the On or Off state. Specify True to set the switch to the On state.
Discussion
Use this method to set the value of a switch. If you want to know the value of a switch, use a local variable to track that information.