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

# intersection(_:)

Returns the range, if any, where two text ranges intersect.

## Declaration

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

## Parameters

- `textRange`: The range used to compare against the current range to evaluate for differences.

## Return Value

Return Value An NSRange that represents the intersection of the ranges, or nil if they don’t intersect.

## See Also

### Comparing text ranges

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