<!--
{
  "availability" : [
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKInterfaceSwitch/setOn(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKInterfaceSwitch(im)setOn:"
  },
  "title" : "setOn(_:)"
}
-->

# setOn(_:)

Sets the state of the switch to the specified value.

```
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

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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)