<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextContentManager",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "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/AppKit/NSTextContentManager/init())

Creates a new content manager.

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

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

### Controlling backing store synchronization

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

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

### Performing transactions

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

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

[`-  performEditingTransactionUsingBlock:`](/documentation/AppKit/NSTextContentManager/performEditingTransaction(_:))

Performs an editing transaction and invokes a block upon completion.

[`-  recordEditActionInRange:newTextRange:`](/documentation/AppKit/NSTextContentManager/recordEditAction(in:newTextRange:))

Records information about an edit action to the transaction.

### Working with layout managers

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

The primary text layout manager for this content.

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

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

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

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

[`-  addTextLayoutManager:`](/documentation/AppKit/NSTextContentManager/addTextLayoutManager(_:))

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

[`-  removeTextLayoutManager:`](/documentation/AppKit/NSTextContentManager/removeTextLayoutManager(_:))

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

[`-  synchronizeTextLayoutManagers:`](/documentation/AppKit/NSTextContentManager/synchronizeTextLayoutManagers(_:))

Synchronizes changes to all nonprimary text layout managers.

### Customizing and validating text elements

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

The delegate for the content manager object.

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

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

[`EnumerationOptions`](/documentation/AppKit/NSTextContentManager/EnumerationOptions)

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

### Finding a specific text element

[`-  textElementsForRange:`](/documentation/AppKit/NSTextContentManager/textElements(for:))

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

## Relationships

### Conforms To

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

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

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

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

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

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

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

[`NSTextElementProvider`](/documentation/AppKit/NSTextElementProvider)

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

### Inherited By

[`NSTextContentStorage`](/documentation/AppKit/NSTextContentStorage)

### 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)