A control that offers a binary choice.


@interface NSSwitch : NSControl


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 continuous is YES, the switch sends its action for each change in position during the drag.

Use a switch to toggle significant preferences, or preferences that provide access to other controls. Avoid creating lists or tables of switches; instead, for general-purpose toggles, use an instance of NSButton to display a checkbox.

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.


Managing Switch State


The current position of the switch.


Inherits From

See Also



A control that defines an area on the screen that can be used to trigger actions.


A control that displays a color value and lets the user change that color value.

Date Picker

Display a calendar date and provide controls for editing the date value.


A display of image data from an NSImage object in a frame.


A visual representation of a level or quantity, using discrete values.

Path Control

A display of a file system path or virtual path information.


A control for selecting an item from a list.


An interface that provides visual feedback to the user about the status of an ongoing task.


An interface for configuring a rule-based list of options.


A defined set of rules that allows the editing of predicate objects.

Search Field

Provide a text field that is optimized for text-based search interfaces.


Display one or more buttons in a single horizontal group.


Display a range of values from which the user selects a single value.


An interface with up and down arrow buttons for incrementing or decrementing a value.

Text Field

Provide a simple interface for displaying and editing text, including support for password fields and secure forms of text entry.

Token Field

Provide a text field whose text can be rendered in a visually distinct way so that users can recognize portions more easily.


Provide a space for controls under a window's title bar and above your custom content.

Combo Box

Display a list of values in a pop-up menu that lets the user select a value or type in a custom value.


A legacy interface for grouping radio buttons or other types of cells together.