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

# NSTextFinderClient

A set of methods implemented by objects that support searching using the [`NSTextFinder`](/documentation/AppKit/NSTextFinder) class and the in-window text find bar.

```
protocol NSTextFinderClient : NSObjectProtocol
```

## Overview

See [`NSTextFinder`](/documentation/AppKit/NSTextFinder) for details.

## Topics

### String Searching

[`string`](/documentation/AppKit/NSTextFinderClient/string)

Allows the client to specify a single string for searching.

[`string(at:effectiveRange:endsWithSearchBoundary:)`](/documentation/AppKit/NSTextFinderClient/string(at:effectiveRange:endsWithSearchBoundary:))

Returns the found string that is created by conceptually mapping its content to a single string, which is composed of a concatenation of all its substrings.

[`stringLength()`](/documentation/AppKit/NSTextFinderClient/stringLength())

Returns the full length of the conceptually concatenated string return by the `stringAtIndex:effectiveRange:endsWithSearchBoundary:` method.

### Replacing Text

[`shouldReplaceCharacters(inRanges:with:)`](/documentation/AppKit/NSTextFinderClient/shouldReplaceCharacters(inRanges:with:))

Returns whether the specified strings should be replaced.

[`replaceCharacters(in:with:)`](/documentation/AppKit/NSTextFinderClient/replaceCharacters(in:with:))

Replaces the text in the specified range with the new string.

[`didReplaceCharacters()`](/documentation/AppKit/NSTextFinderClient/didReplaceCharacters())

Specifies whether text characters were replaced.

### Selection Information

[`isSelectable`](/documentation/AppKit/NSTextFinderClient/isSelectable)

Returns whether the text is selectable.

[`allowsMultipleSelection`](/documentation/AppKit/NSTextFinderClient/allowsMultipleSelection)

Returns whether multiple items can be selected.

[`firstSelectedRange`](/documentation/AppKit/NSTextFinderClient/firstSelectedRange)

Returns the currently selected range.

[`selectedRanges`](/documentation/AppKit/NSTextFinderClient/selectedRanges)

Returns an array of selected ranges.

### Text Edibility

[`isEditable`](/documentation/AppKit/NSTextFinderClient/isEditable)

Returns whether the text is editable.

### Determining and Displaying Text Locations

[`contentView(at:effectiveCharacterRange:)`](/documentation/AppKit/NSTextFinderClient/contentView(at:effectiveCharacterRange:))

Returns the view the context is displayed in.

[`rects(forCharacterRange:)`](/documentation/AppKit/NSTextFinderClient/rects(forCharacterRange:))

An array containing the located text in the content view’s coordinate system.

[`scrollRangeToVisible(_:)`](/documentation/AppKit/NSTextFinderClient/scrollRangeToVisible(_:))

Scrolls the specified range such that it is visible.

[`visibleCharacterRanges`](/documentation/AppKit/NSTextFinderClient/visibleCharacterRanges)

An array of visible character ranges.

### Drawing Glyphs

[`drawCharacters(in:forContentView:)`](/documentation/AppKit/NSTextFinderClient/drawCharacters(in:forContentView:))

Draw the glyphs for the requested character range as they are drawn in the given content view.



---

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)