Contents

NSSwitch

A control that offers a binary choice.

Declaration

class NSSwitch

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

See Also

Controls