---
title: "tokenField(_:styleForRepresentedObject:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstokenfielddelegate/tokenfield(_:styleforrepresentedobject:)"
---

# tokenField(_:styleForRepresentedObject:)

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

## Declaration

```swift
@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

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

## Discussion

Discussion If the delegate implements this method and returns an NSTokenField.TokenStyle that differs from the style set by tokenStyle, the value the delegate returns is preferred. If the delegate does not implement this method, the token field’s tokenStyle is used.

## See Also

### Displaying Tokenized Strings

- [tokenField(_:displayStringForRepresentedObject:)](appkit/nstokenfielddelegate/tokenfield(_:displaystringforrepresentedobject:).md)
