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

# NSControlTextEditingDelegate

A set of optional methods implemented by delegates of [`NSControl`](/documentation/AppKit/NSControl) subclasses to respond to editing actions.

```
protocol NSControlTextEditingDelegate : NSObjectProtocol
```

## Topics

### Validating a Control’s Value

[`control(_:isValidObject:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:isValidObject:))

Invoked when the insertion point leaves a cell belonging to the specified control, but before the value of the cell’s object is displayed.

[`control(_:didFailToValidatePartialString:errorDescription:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToValidatePartialString:errorDescription:))

Invoked when the formatter for the cell belonging to `control` (or selected cell) rejects a partial string a user is typing into the cell.

### Responding to Text Formatting

[`control(_:didFailToFormatString:errorDescription:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToFormatString:errorDescription:))

Invoked when the formatter for the cell belonging to the specified control cannot convert a string to an underlying object.

### Responding to Text Editing

[`control(_:textShouldBeginEditing:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldBeginEditing:))

Invoked when the user tries to enter a character in a cell of a control that allows editing of text (such as a text field or form field).

[`control(_:textShouldEndEditing:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textShouldEndEditing:))

Invoked when the insertion point tries to leave a cell of the control that has been edited.

### Working with Text Completion

[`control(_:textView:completions:forPartialWordRange:indexOfSelectedItem:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textView:completions:forPartialWordRange:indexOfSelectedItem:))

Invoked to allow you to control the list of proposed text completions generated by text fields and other controls.

### Working with Key Bindings

[`control(_:textView:doCommandBy:)`](/documentation/AppKit/NSControlTextEditingDelegate/control(_:textView:doCommandBy:))

Invoked when users press keys with predefined bindings in a cell of the specified control.

### Instance Methods

[`controlTextDidBeginEditing(_:)`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidBeginEditing(_:))

Tells the delegate that the control started editing its text content.

[`controlTextDidChange(_:)`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidChange(_:))

Tells the delegate that the control made changes to its text content.

[`controlTextDidEndEditing(_:)`](/documentation/AppKit/NSControlTextEditingDelegate/controlTextDidEndEditing(_:))

Tells the delegate that the control finished editing its text content and committed the changes.



---

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)