---
title: NSTextLayoutManager
framework: appkit
role: symbol
role_heading: Class
path: appkit/nstextlayoutmanager
---

# NSTextLayoutManager

The primary class that you use to manage text layout and presentation for custom text displays.

## Declaration

```swift
class NSTextLayoutManager
```

## Overview

Overview NSTextLayoutManager is the centerpiece of the TextKit object network that maintains the layout geometry through an array of NSTextContainer objects. It lays out results using NSTextLayoutFragment and NSTextElement objects vended from a NSTextContentManager that participates in the content layout process.

## Topics

### Creating a layout manager

- [init()](appkit/nstextlayoutmanager/init().md)
- [init(coder:)](appkit/nstextlayoutmanager/init(coder:).md)

### Configuring global layout manager options

- [layoutQueue](appkit/nstextlayoutmanager/layoutqueue.md)
- [renderingAttributesValidator](appkit/nstextlayoutmanager/renderingattributesvalidator.md)
- [usesFontLeading](appkit/nstextlayoutmanager/usesfontleading.md)
- [usesHyphenation](appkit/nstextlayoutmanager/useshyphenation.md)
- [limitsLayoutForSuspiciousContents](appkit/nstextlayoutmanager/limitslayoutforsuspiciouscontents.md)

### Managing the layout process

- [delegate](appkit/nstextlayoutmanager/delegate.md)
- [NSTextLayoutManagerDelegate](appkit/nstextlayoutmanagerdelegate.md)

### Accessing the text storage

- [textContentManager](appkit/nstextlayoutmanager/textcontentmanager.md)
- [textContainer](appkit/nstextlayoutmanager/textcontainer.md)
- [textSelectionNavigation](appkit/nstextlayoutmanager/textselectionnavigation.md)
- [textSelections](appkit/nstextlayoutmanager/textselections.md)
- [usageBoundsForTextContainer](appkit/nstextlayoutmanager/usageboundsfortextcontainer.md)
- [enumerateTextSegments(in:type:options:using:)](appkit/nstextlayoutmanager/enumeratetextsegments(in:type:options:using:).md)
- [replace(_:)](appkit/nstextlayoutmanager/replace(_:).md)
- [replaceContents(in:with:)](appkit/nstextlayoutmanager/replacecontents(in:with:)-2elb.md)
- [replaceContents(in:with:)](appkit/nstextlayoutmanager/replacecontents(in:with:)-80j0b.md)

### Adjusting rendering

- [linkRenderingAttributes](appkit/nstextlayoutmanager/linkrenderingattributes.md)
- [addRenderingAttribute(_:value:for:)](appkit/nstextlayoutmanager/addrenderingattribute(_:value:for:).md)
- [enumerateRenderingAttributes(from:reverse:using:)](appkit/nstextlayoutmanager/enumeraterenderingattributes(from:reverse:using:).md)
- [renderingAttributes(forLink:at:)](appkit/nstextlayoutmanager/renderingattributes(forlink:at:).md)
- [invalidateRenderingAttributes(for:)](appkit/nstextlayoutmanager/invalidaterenderingattributes(for:).md)
- [removeRenderingAttribute(_:for:)](appkit/nstextlayoutmanager/removerenderingattribute(_:for:).md)
- [setRenderingAttributes(_:for:)](appkit/nstextlayoutmanager/setrenderingattributes(_:for:).md)

### Causing layout generation

- [textViewportLayoutController](appkit/nstextlayoutmanager/textviewportlayoutcontroller.md)
- [invalidateLayout(for:)](appkit/nstextlayoutmanager/invalidatelayout(for:).md)
- [textLayoutFragment(for:)](appkit/nstextlayoutmanager/textlayoutfragment(for:)-68dez.md)
- [textLayoutFragment(for:)](appkit/nstextlayoutmanager/textlayoutfragment(for:)-4dhrx.md)
- [ensureLayout(for:)](appkit/nstextlayoutmanager/ensurelayout(for:)-6ptsj.md)
- [ensureLayout(for:)](appkit/nstextlayoutmanager/ensurelayout(for:)-3duae.md)
- [enumerateTextLayoutFragments(from:options:using:)](appkit/nstextlayoutmanager/enumeratetextlayoutfragments(from:options:using:).md)
- [NSTextLayoutManager.SegmentType](appkit/nstextlayoutmanager/segmenttype.md)
- [NSTextLayoutManager.SegmentOptions](appkit/nstextlayoutmanager/segmentoptions.md)

### Instance Properties

- [resolvesNaturalAlignmentWithBaseWritingDirection](appkit/nstextlayoutmanager/resolvesnaturalalignmentwithbasewritingdirection.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [NSTextSelectionDataSource](appkit/nstextselectiondatasource.md)

## See Also

### Layout

- [Using TextKit 2 to interact with text](uikit/using-textkit-2-to-interact-with-text.md)
- [NSTextContainer](appkit/nstextcontainer.md)
- [NSTextLayoutFragment](appkit/nstextlayoutfragment.md)
- [NSTextLineFragment](appkit/nstextlinefragment.md)
- [NSTextViewportLayoutController](appkit/nstextviewportlayoutcontroller.md)
- [NSTextLayoutOrientationProvider](appkit/nstextlayoutorientationprovider.md)
