Contents

writeSelection(to:types:)

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

Declaration

func writeSelection(to pboard: NSPasteboard, types: [NSPasteboard.PasteboardType]) -> Bool

Parameters

  • pboard:

    The pasteboard to write to.

  • types:

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

Return Value

true if the data for any single type was successfully written, false otherwise.

Discussion

This method declares the data types on pboard and then invokes writeSelection(to:type:) or the delegate method textView(_:write:at:to: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