---
title: NSTextElementProvider
framework: appkit
role: symbol
role_heading: Protocol
path: appkit/nstextelementprovider
---

# NSTextElementProvider

A protocol the text content manager and its concrete subclasses conform to, which defines the interface for interacting with custom content types of a text document.

## Declaration

```swift
protocol NSTextElementProvider : NSObjectProtocol
```

## Topics

### Accessing the range of the text element

- [documentRange](appkit/nstextelementprovider/documentrange.md)

### Accessing and updating the text

- [enumerateTextElements(from:options:using:)](appkit/nstextelementprovider/enumeratetextelements(from:options:using:).md)
- [NSTextLayoutFragment.EnumerationOptions](appkit/nstextlayoutfragment/enumerationoptions.md)
- [location(_:offsetBy:)](appkit/nstextelementprovider/location(_:offsetby:).md)
- [replaceContents(in:with:)](appkit/nstextelementprovider/replacecontents(in:with:).md)

### Adjusting the range of the text element

- [adjustedRange(from:forEditingTextSelection:)](appkit/nstextelementprovider/adjustedrange(from:foreditingtextselection:).md)
- [offset(from:to:)](appkit/nstextelementprovider/offset(from:to:).md)

### Controlling synchronization with the backing store

- [synchronizeToBackingStore(_:)](appkit/nstextelementprovider/synchronizetobackingstore(_:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Conforming Types

- [NSTextContentManager](appkit/nstextcontentmanager.md)
- [NSTextContentStorage](appkit/nstextcontentstorage.md)

## See Also

### Content elements

- [Enriching your text in text views](uikit/enriching-your-text-in-text-views.md)
- [NSTextParagraph](appkit/nstextparagraph.md)
- [NSTextListElement](appkit/nstextlistelement.md)
- [NSTextElement](appkit/nstextelement.md)
