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

# NSTextContentManager

An abstract class that defines the interface and a default implementation for managing the text document contents.

```
class NSTextContentManager
```

## Topics

### Creating a content manager

[`init()`](/documentation/UIKit/NSTextContentManager/init())

Creates a new content manager.

[`init(coder:)`](/documentation/UIKit/NSTextContentManager/init(coder:))

Creates a new content manager object from data in an unarchiver.

### Controlling backing store synchronization

[`automaticallySynchronizesToBackingStore`](/documentation/UIKit/NSTextContentManager/automaticallySynchronizesToBackingStore)

Determines whether to automatically synchronize with the backing store when an editing transaction finishes.

### Performing transactions

[`hasEditingTransaction`](/documentation/UIKit/NSTextContentManager/hasEditingTransaction)

Indicates there’s an active editing transaction from the primary text layout manager.

[`performEditingTransaction(_:)`](/documentation/UIKit/NSTextContentManager/performEditingTransaction(_:))

Performs an editing transaction and invokes a block upon completion.

[`recordEditAction(in:newTextRange:)`](/documentation/UIKit/NSTextContentManager/recordEditAction(in:newTextRange:))

Records information about an edit action to the transaction.

### Working with layout managers

[`primaryTextLayoutManager`](/documentation/UIKit/NSTextContentManager/primaryTextLayoutManager)

The primary text layout manager for this content.

[`textLayoutManagers`](/documentation/UIKit/NSTextContentManager/textLayoutManagers)

The array of text layout managers associated with this text content manager.

[`automaticallySynchronizesTextLayoutManagers`](/documentation/UIKit/NSTextContentManager/automaticallySynchronizesTextLayoutManagers)

Determines if the framework should automatically synchronize all text layout managers when exiting an editing transaction.

[`addTextLayoutManager(_:)`](/documentation/UIKit/NSTextContentManager/addTextLayoutManager(_:))

Adds the layout manager you provide to the list of layout managers.

[`removeTextLayoutManager(_:)`](/documentation/UIKit/NSTextContentManager/removeTextLayoutManager(_:))

Removes the layout manager you specifiy from the list of layout managers.

[`synchronizeTextLayoutManagers(_:)`](/documentation/UIKit/NSTextContentManager/synchronizeTextLayoutManagers(_:))

Synchronizes changes to all nonprimary text layout managers.

### Customizing and validating text elements

[`delegate`](/documentation/UIKit/NSTextContentManager/delegate)

The delegate for the content manager object.

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

The optional methods that delegates of content manager objects implement for customizing or validating text elements.

[`NSTextContentManager.EnumerationOptions`](/documentation/UIKit/NSTextContentManager/EnumerationOptions)

Values that control the order in which the framework enumerates text elements.

### Finding a specific text element

[`textElements(for:)`](/documentation/UIKit/NSTextContentManager/textElements(for:))

Returns an array of text elements that intersect with the range you specify.



---

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)