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

# tokenField(_:writeRepresentedObjects:to:)

Sent so the delegate can write represented objects to the pasteboard corresponding to a given array of display strings.

```
@MainActor optional func tokenField(_ tokenField: NSTokenField, writeRepresentedObjects objects: [Any], to pboard: NSPasteboard) -> Bool
```

## Parameters

`tokenField`

The token field that sent the message.

`objects`

An array of represented objects associated with the token field.

`pboard`

The pasteboard to which to write the represented objects.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the delegate writes the represented objects to the pasteboard, <doc://com.apple.documentation/documentation/Swift/false> otherwise. If <doc://com.apple.documentation/documentation/Swift/false>, the token field writes the display strings to the [`NSStringPboardType`](/documentation/AppKit/NSStringPboardType) pasteboard.

---

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)