---
title: "textView(_:write:at:to:type:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/textview(_:write:at:to:type:)"
---

# textView(_:write:at:to:type:)

Returns whether data of the specified type for the given cell could be written to the specified pasteboard.

## Declaration

```swift
@MainActor optional func textView(_ view: NSTextView, write cell: any NSTextAttachmentCellProtocol, at charIndex: Int, to pboard: NSPasteboard, type: NSPasteboard.PasteboardType) -> Bool
```

## Parameters

- `view`: The text view sending the message.
- `cell`: The cell whose contents should be written to the pasteboard.
- `charIndex`: The index at which the cell was accessed.
- `pboard`: The pasteboard to which the cell’s contents should be written.
- `type`: The type of data that should be written.

## Return Value

Return Value true if the write succeeded, false otherwise.

## Discussion

Discussion The receiver should attempt to write the cell to pboard with the given type, and return success or failure.

## See Also

### Managing the Pasteboard

- [textView(_:writablePasteboardTypesFor:at:)](appkit/nstextviewdelegate/textview(_:writablepasteboardtypesfor:at:).md)
