<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextList",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextList"
  },
  "title" : "NSTextList"
}
-->

# NSTextList

A section of text that forms a single list.

```
class NSTextList
```

## Overview

The visible elements of the list, including list markers, appear in the text as they do for lists created by hand. The list object, however, allows the list to be recognized as such by the text system. This enables automatic creation of markers and spacing. Text lists are used in HTML import and export.

Text lists appear as attributes on paragraphs, as part of the paragraph style. An [`NSParagraphStyle`](/documentation/AppKit/NSParagraphStyle) may have an array of text lists, representing the nested lists containing the paragraph, in order from outermost to innermost. For example, if list1 contains four paragraphs, the middle two of which are also in the inner list2, then the text lists array for the first and fourth paragraphs is (list1), while the text lists array for the second and third paragraphs is (list1, list2).

The methods implementing this are [`textLists`](/documentation/AppKit/NSParagraphStyle/textLists) on [`NSParagraphStyle`](/documentation/AppKit/NSParagraphStyle), and [`textLists`](/documentation/AppKit/NSMutableParagraphStyle/textLists) on [`NSMutableParagraphStyle`](/documentation/AppKit/NSMutableParagraphStyle).

In addition, <doc://com.apple.documentation/documentation/Foundation/NSAttributedString> has convenience methods for lists, such as <doc://com.apple.documentation/documentation/Foundation/NSAttributedString/range(of:at:)-6um0x>, which determines the range covered by a list, and <doc://com.apple.documentation/documentation/Foundation/NSAttributedString/itemNumber(in:at:)>, which determines the ordinal position within a list of a particular item.

## Topics

### Creating a text list

[`-  initWithCoder:`](/documentation/AppKit/NSTextList/init(coder:))

Initializes and returns a newly allocated text list item.

[`-  initWithMarkerFormat:options:`](/documentation/AppKit/NSTextList/init(markerFormat:options:))

Returns an initialized text list.

[`-  initWithMarkerFormat:options:startingItemNumber:`](/documentation/AppKit/NSTextList/init(markerFormat:options:startingItemNumber:))

Returns a new text list with the format, options, and starting item number you provide.

### Working with markers

[`markerFormat`](/documentation/AppKit/NSTextList/markerFormat-swift.property)

Returns the marker format string used by the receiver.

[`MarkerFormat`](/documentation/AppKit/NSTextList/MarkerFormat-swift.struct)

Constants that describe marker symbols you can apply to list elements in text lists.

[`-  markerForItemNumber:`](/documentation/AppKit/NSTextList/marker(forItemNumber:))

Returns the computed value for a specific ordinal position in the list.

### Getting list options

[`ordered`](/documentation/AppKit/NSTextList/isOrdered)

[`listOptions`](/documentation/AppKit/NSTextList/listOptions)

Returns the list options mask value of the receiver.

[`Options`](/documentation/AppKit/NSTextList/Options)

Values that available options for text list items.

[`includesTextListMarkers`](/documentation/AppKit/NSTextList/includesTextListMarkers)

A Boolean value that indicates whether TextKit includes text list markers in the contents.

### Managing item numbering

[`startingItemNumber`](/documentation/AppKit/NSTextList/startingItemNumber)

Sets the starting item number for the text list.

### Constants

The following constant specifies an option mask used with [`-  initWithMarkerFormat:options:`](/documentation/AppKit/NSTextList/init(markerFormat:options:))

Returns an initialized text list..

[`NSTextListPrependEnclosingMarker`](/documentation/AppKit/NSTextList/Options/prependEnclosingMarker)

Specifies that a nested list should include the marker for its enclosing superlist before its own marker.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)