NSButton.ButtonType.accelerator
A button that sends repeating actions as pressure changes occur.
Declaration
case acceleratorDiscussion
A media player app, for example, might implement an accelerator button to allow a user to adjust the speed of fast forward or rewind with variable pressure. In this case, the button sends actions to the app to indicate when pressure on the button changes. The app then determines the amount of current pressure, and adjusts the playback speed accordingly.
An accelerator button sends an action when the user first clicks the button and continues sending actions until the user releases pressure on the button.
For accelerator buttons with isContinuous set to true, the interval between repeating actions automatically adjusts to match the pressure the user applies. Use setPeriodicDelay(_:interval:) to configure the interval. As the user presses harder, the button sends actions more rapidly. As the user reduces pressure on the button, actions slow down. As such, the user has direct control over how fast the button sends actions. Typically, you use continuous accelerator buttons for continuously advancing through a series of discrete objects, such as photos in an album or pages in a book.
Noncontinuous accelerator buttons send actions whenever a change in force occurs. Typically, you use noncontinuous accelerator buttons to adjust the speed of navigation based on pressure, such as playback speed in a media player. After the user releases the button, the button sends a final action.
For buttons that aren’t accelerator buttons, the value of the button matches its state. For accelerator buttons, the value of the button is distinct from its state and indicates pressure level. When the user force clicks the button, doubleValue is a measurement of pressure between 1.0 and approaching 2.0. When the user releases the button, doubleValue is 0.0.
An accelerator button appears like any other button and doesn’t provide any visual indication that it supports variable pressure. To provide this type of visual indication, you can apply a custom image to the button.
On a system that doesn’t support pressure sensitivity, an accelerator button behaves like a button of type NSMomentaryLightButton.
This option corresponds to the Accelerator type in Interface Builder’s Attributes inspector.