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

# NSTextSelectionNavigation

An interface you use to expose methods for obtaining results from actions performed on text selections.

```
class NSTextSelectionNavigation
```

## Topics

### Creating a selection navigation

[`-  initWithDataSource:`](/documentation/AppKit/NSTextSelectionNavigation/init(dataSource:))

Creates a new object using the text selection data source you provide.

### Selection characteristics

[`allowsNonContiguousRanges`](/documentation/AppKit/NSTextSelectionNavigation/allowsNonContiguousRanges)

Determines if the instance could produce selections with multiple noncontiguous selections.

[`rotatesCoordinateSystemForLayoutOrientation`](/documentation/AppKit/NSTextSelectionNavigation/rotatesCoordinateSystemForLayoutOrientation)

Determines if the framework rotates the coordinate system to match the layout orientation.

[`Modifier`](/documentation/AppKit/NSTextSelectionNavigation/Modifier)

Values that describe how the framework handles different kinds of selection modifiers.

[`Destination`](/documentation/AppKit/NSTextSelectionNavigation/Destination)

Values that affect how the framework handles navigation across different textual boundaries during a selection.

[`Direction`](/documentation/AppKit/NSTextSelectionNavigation/Direction)

Values that describe the direction of a selection.

[`-  textSelectionForSelectionGranularity:enclosingPoint:inContainerAtLocation:`](/documentation/AppKit/NSTextSelectionNavigation/textSelection(for:enclosing:inContainerAt:))

Returns a text selection that expands to the nearest boundaries for selection granularity and an enclosing point you specify.

### Accessing the data source

[`textSelectionDataSource`](/documentation/AppKit/NSTextSelectionNavigation/textSelectionDataSource)

The data source associated with this selection navigation.

[`NSTextSelectionDataSource`](/documentation/AppKit/NSTextSelectionDataSource)

A set of methods that objects implement to provide data for, and manage text selections.

### Working with text selections

[`-  textSelectionForSelectionGranularity:enclosingTextSelection:`](/documentation/AppKit/NSTextSelectionNavigation/textSelection(for:enclosing:))

Returns a text selection expanded to the nearest boundaries for the selection granularity and enclosing text selection text ranges you specify.

[`-  textSelectionsInteractingAtPoint:inContainerAtLocation:anchors:modifiers:selecting:bounds:`](/documentation/AppKit/NSTextSelectionNavigation/textSelections(interactingAt:inContainerAt:anchors:modifiers:selecting:bounds:))

Returns an array of text selections produced by a tap or click at the point you specify.

[`-  destinationSelectionForTextSelection:direction:destination:extending:confined:`](/documentation/AppKit/NSTextSelectionNavigation/destinationSelection(for:direction:destination:extending:confined:))

Returns a new selection that results from applying the navigation operations you specify to the text selection you provide.

### Controlling cache behavior

[`-  flushLayoutCache`](/documentation/AppKit/NSTextSelectionNavigation/flushLayoutCache())

Flushes cached layout information.

### Finding the insertion point

[`-  resolvedInsertionLocationForTextSelection:writingDirection:`](/documentation/AppKit/NSTextSelectionNavigation/resolvedInsertionLocation(for:writingDirection:))

Returns the location for inserting the next input depending on the state of the current and secondary selections.

### Specifying deletion ranges

[`-  deletionRangesForTextSelection:direction:destination:allowsDecomposition:`](/documentation/AppKit/NSTextSelectionNavigation/deletionRanges(for:direction:destination:allowsDecomposition:))

Returns the ranges for deleting the text based on the current selection and movement arguments.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

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

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)