---
title: "setOn(_:)"
framework: watchkit
role: symbol
role_heading: Instance Method
path: "watchkit/wkinterfaceswitch/seton(_:)"
---

# setOn(_:)

Sets the state of the switch to the specified value.

## Declaration

```swift
func setOn(_ on: Bool)
```

## Parameters

- `on`: A Boolean value indicating whether the switch should be set to the On or Off state. Specify doc://com.apple.documentation/documentation/Swift/true to set the switch to the On state.

## Discussion

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.

## See Also

### Configuring the Switch

- [setColor(_:)](watchkit/wkinterfaceswitch/setcolor(_:).md)
