---
title: "compare(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextlocation/compare(_:)"
---

# compare(_:)

Compares and returns the logical ordering to location.

## Declaration

```swift
func compare(_ location: any NSTextLocation) -> ComparisonResult
```

## Parameters

- `location`: The location to compare the current location to.

## Return Value

Return Value A ComparisonResult.
