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

# tokenField(_:menuForRepresentedObject:)

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

## Declaration

```swift
@MainActor optional func tokenField(_ tokenField: NSTokenField, menuForRepresentedObject representedObject: Any) -> NSMenu?
```

## Parameters

- `tokenField`: The token field that sent the message.
- `representedObject`: A represented object of the token field.

## Return Value

Return Value The menu associated with the  represented object.

## Discussion

Discussion The returned menu should be autoreleased. By default tokens in a token field do not return menus.

## See Also

### Managing Menus for Represented Objects

- [tokenField(_:hasMenuForRepresentedObject:)](appkit/nstokenfielddelegate/tokenfield(_:hasmenuforrepresentedobject:).md)
