---
title: "textElements(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextcontentmanager/textelements(for:)"
---

# textElements(for:)

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

## Declaration

```swift
func textElements(for range: NSTextRange) -> [NSTextElement]
```

## Parameters

- `range`: An doc://com.apple.appkit/documentation/AppKit/NSTextRange that describes the range of text to process.

## Return Value

Return Value An array of NSTextElement.

## Discussion

Discussion This method can return a set of elements that don’t fill the entire range if the entire range isn’t synchronously available. Uses enumerateTextElements(from:options:using:) to fill the array.
