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

# NSTextFieldDelegate

A protocol that a text field delegate can use to control its field editor action menu.

```
protocol NSTextFieldDelegate : NSControlTextEditingDelegate
```

## Topics

### Controlling Editing Behavior

[`-  textField:textView:candidates:forSelectedRange:`](/documentation/AppKit/NSTextFieldDelegate/textField(_:textView:candidates:forSelectedRange:))

Allows customizing the candidate list queried from `NSSpellChecker`. This method returns array of text objects to include in a text selection.

[`-  textField:textView:candidatesForSelectedRange:`](/documentation/AppKit/NSTextFieldDelegate/textField(_:textView:candidatesForSelectedRange:))

Provides a customized list of candidates to the text view’s `candidateListTouchBarItem`. This method returns an array of objects that represent the elements of a selection.

[`-  textField:textView:shouldSelectCandidateAtIndex:`](/documentation/AppKit/NSTextFieldDelegate/textField(_:textView:shouldSelectCandidateAt:))

Notifies the delegate that the user selected the candidate at index in `-[NSCandidateListTouchBarItem candidates]` for the text view’s `candidateListTouchBarItem`. Returns a Boolean value that indicates whether to select the text object at the index.

## Relationships

### Inherited By

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

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

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

### Inherits From

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

[`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)