<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTokenFieldDelegate/tokenField(_:styleForRepresentedObject:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTokenFieldDelegate(im)tokenField:styleForRepresentedObject:"
  },
  "title" : "tokenField(_:styleForRepresentedObject:)"
}
-->

# tokenField(_:styleForRepresentedObject:)

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

```
@MainActor optional func tokenField(_ tokenField: NSTokenField, styleForRepresentedObject representedObject: Any) -> NSTokenField.TokenStyle
```

## Parameters

`tokenField`

The token field that sent the message.

`representedObject`

A represented object of the token field.

## Return Value

The style that should be used to display the representedObject. Possible values are shown in NSTokenStyle Values.

## Discussion

If the delegate implements this method and returns an [`NSTokenField.TokenStyle`](/documentation/AppKit/NSTokenField/TokenStyle-swift.enum) that differs from the style set by [`tokenStyle`](/documentation/AppKit/NSTokenField/tokenStyle-swift.property), the value the delegate returns is preferred.

If the delegate does not implement this method, the token field’s [`tokenStyle`](/documentation/AppKit/NSTokenField/tokenStyle-swift.property) is used.

---

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)