Instance Method


Writes the current selection to the specified pasteboard under each given type.


- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray<NSPasteboardType> *)types;



The pasteboard to write to.


An array of strings describing the types of data to write.

Return Value

YES if the data for any single type was successfully written, NO otherwise.


This method declares the data types on pboard and then invokes writeSelectionToPasteboard:type: or the delegate method textView:writeCell:atIndex:toPasteboard:type: for each type in the types array.

You should not need to override this method. You might need to invoke this method if you are implementing a new type of pasteboard to handle services other than copy/paste or dragging.

See Also

Managing the Pasteboard

- preferredPasteboardTypeFromArray:restrictedToTypesFromArray:

Returns whatever type on the pasteboard would be most preferred for copying data.

- readSelectionFromPasteboard:

Reads the text view’s preferred type of data from the specified pasteboard.

- readSelectionFromPasteboard:type:

Reads data of the given type from the specified pasteboard.


The types this text view can read immediately from the pasteboard.


The pasteboard types that can be provided from the current selection.

- writeSelectionToPasteboard:type:

Writes the current selection to the specified pasteboard using the given type.

- validRequestorForSendType:returnType:

Returns self if the text view can provide and accept the specified data types, or nil if it can't.