---
title: "union(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextrange/union(_:)"
---

# union(_:)

Returns a new text range by forming the union with the text range you provide.

## Declaration

```swift
func union(_ textRange: NSTextRange) -> Self
```

## Parameters

- `textRange`: The range to use to create the union.

## Return Value

Return Value An NSTextRange that represent the union of the two ranges.

## See Also

### Comparing text ranges

- [intersection(_:)](appkit/nstextrange/intersection(_:).md)
- [intersects(_:)](appkit/nstextrange/intersects(_:).md)
- [isEqual(to:)](appkit/nstextrange/isequal(to:).md)
