<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextRange/contains(_:)-5j4y2",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextRange(im)containsRange:"
  },
  "title" : "contains(_:)"
}
-->

# contains(_:)

Determines if the text range you specify is in the current text range.

```
func contains(_ textRange: NSTextRange) -> Bool
```

## Parameters

`textRange`

An [`NSTextRange`](/documentation/AppKit/NSTextRange).

## Return Value

Returns `true` if the range you provide is in the current range; otherwise `false`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)