---
title: NSSwitch
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsswitch
---

# NSSwitch

A control that offers a binary choice.

## Declaration

```swift
class NSSwitch
```

## Overview

Overview The NSSwitch class provides a simple interface for displaying and toggling a Boolean state, such as on/off. A switch toggles its state and sends its action when clicked, activated through the keyboard, or tapped in the Touch Bar. NSSwitch also allows dragging between states, and if isContinuous is true, the switch sends its action for each change in position during the drag. NSSwitch doesn’t use an instance of NSCell to provide its functionality. The cellClass class property and cell instance property both return nil, and they ignore attempts to set a non-nil value. For design guidance, see Human Interface Guidelines > Toggles.

## Topics

### Managing Switch State

- [state](appkit/nsswitch/state.md)

## Relationships

### Inherits From

- [NSControl](appkit/nscontrol.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAccessibilityButton](appkit/nsaccessibilitybutton.md)
- [NSAccessibilityElementProtocol](appkit/nsaccessibilityelementprotocol.md)
- [NSAccessibilityProtocol](appkit/nsaccessibilityprotocol.md)
- [NSAccessibilitySwitch](appkit/nsaccessibilityswitch.md)
- [NSAnimatablePropertyContainer](appkit/nsanimatablepropertycontainer.md)
- [NSAppearanceCustomization](appkit/nsappearancecustomization.md)
- [NSCoding](foundation/nscoding.md)
- [NSDraggingDestination](appkit/nsdraggingdestination.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Controls

- [Responding to control-based events using target-action](uikit/responding-to-control-based-events-using-target-action.md)
- [NSButton](appkit/nsbutton.md)
- [NSColorWell](appkit/nscolorwell.md)
- [Combo Box](appkit/combo-box.md)
- [NSComboButton](appkit/nscombobutton.md)
- [Date Picker](appkit/date-picker.md)
- [NSImageView](appkit/nsimageview.md)
- [NSLevelIndicator](appkit/nslevelindicator.md)
- [Path Control](appkit/path-control.md)
- [NSPopUpButton](appkit/nspopupbutton.md)
- [NSProgressIndicator](appkit/nsprogressindicator.md)
- [NSRuleEditor](appkit/nsruleeditor.md)
- [NSPredicateEditor](appkit/nspredicateeditor.md)
- [Search Field](appkit/search-field.md)
- [NSSegmentedControl](appkit/nssegmentedcontrol.md)
