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

# textView(_:writablePasteboardTypesFor:at:)

Returns the writable pasteboard types for a given cell.

```
@MainActor optional func textView(_ view: NSTextView, writablePasteboardTypesFor cell: any NSTextAttachmentCellProtocol, at charIndex: Int) -> [NSPasteboard.PasteboardType]
```

## Parameters

`view`

The text view sending the message.

`cell`

The cell in question.

`charIndex`

The character index in the text view that was clicked.

## Return Value

An array of types that can be written to the pasteboard for `cell`.

## Discussion

This method is invoked after the user clicks `cell` at the specified `charIndex` location in `aTextView`. If the [`textView(_:draggedCell:in:event:at:)`](/documentation/AppKit/NSTextViewDelegate/textView(_:draggedCell:in:event:at:)) is not used, this method and [`textView(_:write:at:to:type:)`](/documentation/AppKit/NSTextViewDelegate/textView(_:write:at:to:type:)) allow `aTextView` to take care of attachment dragging and pasting, with the delegate responsible only for writing the attachment to the 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)