---
title: NSTextInputClient
framework: appkit
role: symbol
role_heading: Protocol
path: appkit/nstextinputclient
---

# NSTextInputClient

A set of methods that text views need to implement to interact properly with the text input management system.

## Declaration

```swift
protocol NSTextInputClient : NSObjectProtocol
```

## Mentioned in

Adopting the system text cursor in custom text views

## Overview

Overview To create another text view class, you can either subclass NSTextView, or subclass NSView and implement the NSTextInputClient protocol. important: Methods specific to the NSTextInputClient protocol are intended for dealing with text input and generally aren’t suitable for other purposes.

## Topics

### Handling marked text

- [hasMarkedText()](appkit/nstextinputclient/hasmarkedtext().md)
- [markedRange()](appkit/nstextinputclient/markedrange().md)
- [selectedRange()](appkit/nstextinputclient/selectedrange().md)
- [setMarkedText(_:selectedRange:replacementRange:)](appkit/nstextinputclient/setmarkedtext(_:selectedrange:replacementrange:).md)
- [unmarkText()](appkit/nstextinputclient/unmarktext().md)
- [validAttributesForMarkedText()](appkit/nstextinputclient/validattributesformarkedtext().md)

### Storing text

- [attributedString()](appkit/nstextinputclient/attributedstring().md)
- [attributedSubstring(forProposedRange:actualRange:)](appkit/nstextinputclient/attributedsubstring(forproposedrange:actualrange:).md)
- [insertText(_:replacementRange:)](appkit/nstextinputclient/inserttext(_:replacementrange:).md)

### Getting character coordinates

- [characterIndex(for:)](appkit/nstextinputclient/characterindex(for:).md)
- [firstRect(forCharacterRange:actualRange:)](appkit/nstextinputclient/firstrect(forcharacterrange:actualrange:).md)
- [baselineDeltaForCharacter(at:)](appkit/nstextinputclient/baselinedeltaforcharacter(at:).md)
- [drawsVerticallyForCharacter(at:)](appkit/nstextinputclient/drawsverticallyforcharacter(at:).md)
- [fractionOfDistanceThroughGlyph(for:)](appkit/nstextinputclient/fractionofdistancethroughglyph(for:).md)

### Placing content

- [documentVisibleRect](appkit/nstextinputclient/documentvisiblerect.md)
- [unionRectInVisibleSelectedRange](appkit/nstextinputclient/unionrectinvisibleselectedrange.md)
- [preferredTextAccessoryPlacement()](appkit/nstextinputclient/preferredtextaccessoryplacement().md)
- [windowLevel()](appkit/nstextinputclient/windowlevel().md)

### Binding keystrokes

- [doCommand(by:)](appkit/nstextinputclient/docommand(by:).md)

### Supporting adaptive images

- [supportsAdaptiveImageGlyph](appkit/nstextinputclient/supportsadaptiveimageglyph.md)
- [insert(_:replacementRange:)](appkit/nstextinputclient/insert(_:replacementrange:).md)

## Relationships

### Inherits From

- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

### Inherited By

- [NSTextCheckingClient](appkit/nstextcheckingclient.md)

### Conforming Types

- [NSTextView](appkit/nstextview.md)

## See Also

### Text input

- [Adopting the system text cursor in custom text views](appkit/adopting-the-system-text-cursor-in-custom-text-views.md)
- [NSTextInputContext](appkit/nstextinputcontext.md)
- [NSTextAlternatives](appkit/nstextalternatives.md)
- [NSTextContent](appkit/nstextcontent.md)
- [NSTextInsertionIndicator](appkit/nstextinsertionindicator.md)
- [NSTextInsertionIndicator.DisplayMode](appkit/nstextinsertionindicator/displaymode-swift.enum.md)
- [NSTextInsertionIndicator.AutomaticModeOptions](appkit/nstextinsertionindicator/automaticmodeoptions-swift.struct.md)
