Instance Method


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


- (NSPasteboardType)preferredPasteboardTypeFromArray:(NSArray<NSPasteboardType> *)availableTypes restrictedToTypesFromArray:(NSArray<NSPasteboardType> *)allowedTypes;



The types currently available on the pasteboard.


Types allowed in the return value. If nil, any available type is allowed.

Return Value

The preferred type to provide given the available types and the allowed types.


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

See Also

Managing the Pasteboard

- 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.

- writeSelectionToPasteboard:types:

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

- validRequestorForSendType:returnType:

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