NSLevel​Indicator is a subclass of NSControl that displays a value on a linear scale.


Level indicators provide a visual representation of a level or amount of something, using discrete values. While similar to NSSlider, it provides a more customized visual feedback to the user. Level indicators do not have a “knob” indicating the current setting or allowing the user to adjust settings. The supported indicator styles include:

  • A capacity style level indicator. The continuous mode for this style is often used to indicate conditions such as how much data is on hard disk. The discrete mode is similar to audio level indicators in audio playback applications. You can specify both a warning value and a critical value that provides additional visual feedback to the user.

  • A ranking style level indicator. This is similar to the star ranking displays provided in iTunes and iPhoto. You can also specify your own ranking image.

  • A relevancy style level indicator. This style is used to display the relevancy of a search result, for example in Mail.

NSLevel​Indicator uses an NSLevel​Indicator​Cell to implement much of the control’s functionality. NSLevel​Indicator provides cover methods for most of the NSLevel​Indicator​Cell methods, which invoke the corresponding cell method.


Configuring the Range of Values

var min​Value:​ Double

The receiver’s minimum value.

var max​Value:​ Double

The receiver’s maximum value.

var warning​Value:​ Double

The receiver’s warning value.

var critical​Value:​ Double

The receiver’s critical value.

Managing Tick Marks and Style

var tick​Mark​Position:​ NSTick​Mark​Position

Determines how the receiver’s tick marks are aligned with it.

var number​Of​Tick​Marks:​ Int

The number of tick marks associated with the receiver.

var number​Of​Major​Tick​Marks:​ Int

The number of major tick marks associated with the receiver.

func tick​Mark​Value(at:​ Int)

Returns the receiver’s value represented by the tick mark at the specified index (the minimum-value tick mark has an index of 0).

func rect​Of​Tick​Mark(at:​ Int)

Returns the bounding rectangle of the tick mark identified by the specified index (the minimum-value tick mark is at index 0).