A tab in an NSParagraphStyle object, storing an alignment type and location.


class NSTextTab : NSObject


NSTextTab objects are most frequently used with the TextKit system and with NSRulerView and NSRulerMarker objects.

The text system supports four alignment types: left, center, right, and decimal (based on the decimal separator character of the locale in effect). These alignment types are absolute, not based on the line sweep direction of text. For example, tabbed text is always positioned to the left of a right-aligned tab, whether the line sweep direction is left to right or right to left. A tab’s location, on the other hand, is relative to the back margin. A tab set at 1.5”, for example, is at 1.5” from the right in right to left text.


Creating a Text Tab

init(textAlignment: NSTextAlignment, location: CGFloat, options: [NSTextTab.OptionKey : Any])

Initializes a text tab with the specified text alignment, location, and options.

Getting Tab Stop Information

var location: CGFloat

The receiver’s ruler location relative to the back margin.

Getting Text Tab Information

var alignment: NSTextAlignment

The text alignment of the receiver.

var options: [NSTextTab.OptionKey : Any]

The dictionary of attributes associated with the receiver.

class func columnTerminators(for: Locale?) -> CharacterSet

Returns the column terminators for the given locale.


init(type: NSParagraphStyle.TextTabType, location: CGFloat)

Initializes a newly allocated text tab with the specified alignment and location.

var tabStopType: NSParagraphStyle.TextTabType

The receiver’s tab stop type.



enum NSParagraphStyle.TextTabType

These constants describe the various type of tab stop.

struct NSTextTab.OptionKey

The terminating character for a tab column.

See Also


class NSParagraphStyle

The paragraph or ruler attributes used by an attributed string.

class NSMutableParagraphStyle

An object that enables changing the values of the subattributes in a paragraph style attribute.