<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextLocation",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextLocation"
  },
  "title" : "NSTextLocation"
}
-->

# NSTextLocation

An interface you implement that represents an abstract location inside your document’s content.

```
protocol NSTextLocation : NSObjectProtocol
```

## Topics

### Comparing text locations

[`func compare(any NSTextLocation) -> ComparisonResult`](/documentation/AppKit/NSTextLocation/compare(_:))

Compares and returns the logical ordering to location.

### Instance Properties

[`var hash: Int`](/documentation/AppKit/NSTextLocation/hash)

Must be consistent with results from `isEqual:` while also avoiding hash collisions.

### Instance Methods

[`func isEqual(Any?) -> Bool`](/documentation/AppKit/NSTextLocation/isEqual(_:))

Returns `true` for locations representing the same document position.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)