A control that offers a binary choice.
- macOS 10.15+Beta
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
true, 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.