<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSwitch/state",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSwitch(py)state"
  },
  "title" : "state"
}
-->

# state

The current position of the switch.

```
var state: NSControl.StateValue { get set }
```

## Discussion

The values [`off`](/documentation/AppKit/NSControl/StateValue/off) and [`on`](/documentation/AppKit/NSControl/StateValue/on) indicate that the switch is in the off or on position. The switch treats any value other than [`off`](/documentation/AppKit/NSControl/StateValue/off) as on.

Setting this property through the [`animator()`](/documentation/AppKit/NSAnimatablePropertyContainer/animator()) proxy animates the switch to the new value.

---

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)