<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSTextListElement",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextListElement"
  },
  "title" : "NSTextListElement"
}
-->

# NSTextListElement

A class that represents a text list node.

```
class NSTextListElement
```

## Topics

### Create a text list element

[`convenience init?(children: [NSTextListElement], textList: NSTextList, nestingLevel: Int)`](/documentation/UIKit/NSTextListElement/init(children:textList:nestingLevel:))

Creates a text list element with the list elements and nesting level you provide.

[`convenience init(contents: NSAttributedString, markerAttributes: [NSAttributedString.Key : Any]?, textList: NSTextList, children: [NSTextListElement]?)`](/documentation/UIKit/NSTextListElement/init(contents:markerAttributes:textList:children:))

Creates a text list element with the list elements, nesting level, and marker attributes you provide.

[`init(parent: NSTextListElement?, textList: NSTextList, contents: NSAttributedString?, markerAttributes: [NSAttributedString.Key : Any]?, children: [NSTextListElement]?)`](/documentation/UIKit/NSTextListElement/init(parent:textList:contents:markerAttributes:children:))

Creates a text list element with the parent, list elements, nesting level, and marker attributes you provide.

### Accessing the text elements

[`var textList: NSTextList`](/documentation/UIKit/NSTextListElement/textList)

The value that represents the text list.

[`var parent: NSTextListElement?`](/documentation/UIKit/NSTextListElement/parent)

A text list element that refers to the enclosing text list element.

[`var childElements: [NSTextListElement]`](/documentation/UIKit/NSTextListElement/childElements)

An array that contains child text elements.

### Accessing the text list’s attributes

[`var markerAttributes: [NSAttributedString.Key : Any]?`](/documentation/UIKit/NSTextListElement/markerAttributes)

A dictionary of attributed string keys and IDs that represent the list’s marker attributes.

### Accessing the formatted string data

[`var attributedString: NSAttributedString`](/documentation/UIKit/NSTextListElement/attributedString)

An attributed string that represents the string the framework displays for this element taking into account markers and the indentation level of the list element.

[`var contents: NSAttributedString?`](/documentation/UIKit/NSTextListElement/contents)

The text list element contents without markers and formatting.

### Initializers

[`convenience init?(childElements: [NSTextListElement], textList: NSTextList, nestingLevel: Int)`](/documentation/UIKit/NSTextListElement/init(childElements:textList:nestingLevel:))

[`convenience init(contents: NSAttributedString, markerAttributes: [NSAttributedString.Key : Any]?, textList: NSTextList, childElements: [NSTextListElement]?)`](/documentation/UIKit/NSTextListElement/init(contents:markerAttributes:textList:childElements:))

[`init(parentElement: NSTextListElement?, textList: NSTextList, contents: NSAttributedString?, markerAttributes: [NSAttributedString.Key : Any]?, childElements: [NSTextListElement]?)`](/documentation/UIKit/NSTextListElement/init(parentElement:textList:contents:markerAttributes:childElements:))

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

### Inherits From

[`NSTextParagraph`](/documentation/UIKit/NSTextParagraph)

---

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)