---
title: NSTextElementProvider
framework: uikit
role: symbol
role_heading: Protocol
path: uikit/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](uikit/nstextelementprovider/documentrange.md)

### Accessing and updating the text

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

### Adjusting the range of the text element

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

### Controlling synchronization with the backing store

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

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Conforming Types

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

## See Also

### Content elements

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