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

# NSTokenFieldCellDelegate

A set of optional methods implemented by delegates of [`NSTokenFieldCell`](/documentation/AppKit/NSTokenFieldCell) objects to work with tokenized strings.

```
protocol NSTokenFieldCellDelegate : NSObjectProtocol
```

## Topics

### Displaying Tokenized Strings

[`-  tokenFieldCell:displayStringForRepresentedObject:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:displayStringForRepresentedObject:))

Allows the delegate to provide a string to be displayed as a proxy for the represented object.

[`-  tokenFieldCell:styleForRepresentedObject:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:styleForRepresentedObject:))

Allows the delegate to return the token style for editing the specified represented object.

### Editing a Tokenized Strings

[`-  tokenFieldCell:completionsForSubstring:indexOfToken:indexOfSelectedItem:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:completionsForSubstring:indexOfToken:indexOfSelectedItem:))

Allows the delegate to provide an array of appropriate completions for the contents of the receiver.

[`-  tokenFieldCell:editingStringForRepresentedObject:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:editingStringForRepresentedObject:))

Allows the delegate to provide a string to be edited as a proxy for the represented object.

[`-  tokenFieldCell:representedObjectForEditingString:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:representedObjectForEditing:))

Allows the delegate to provide a represented object for the string being edited.

[`-  tokenFieldCell:shouldAddObjects:atIndex:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:shouldAdd:at:))

Allows the delegate to validate the tokens to be added to the receiver at a given index.

### Reading To and Writing From the Pasteboard

[`-  tokenFieldCell:readFromPasteboard:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:readFrom:))

Allows the delegate to return an array of objects representing the data read from `pboard`.

[`-  tokenFieldCell:writeRepresentedObjects:toPasteboard:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:writeRepresentedObjects:to:))

Allows the delegate the opportunity to write custom pasteboard types to the pasteboard for the represented objects in `objects`.

### Managing Menus for Represented Objects

[`-  tokenFieldCell:hasMenuForRepresentedObject:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:hasMenuForRepresentedObject:))

Allows the delegate to specify whether the represented object provides a menu.

[`-  tokenFieldCell:menuForRepresentedObject:`](/documentation/AppKit/NSTokenFieldCellDelegate/tokenFieldCell(_:menuForRepresentedObject:))

Allows the delegate to provide a menu for the specified represented object.

## Relationships

### Inherits From

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