Contents

setData(_:forType:)

Sets the data as the representation for the specified type for the first item on the receiver.

Declaration

func setData(_ data: Data?, forType dataType: NSPasteboard.PasteboardType) -> Bool

Parameters

  • data:

    The data to write to the pasteboard.

  • dataType:

    The type of data in the data parameter. The type must have been declared by a previous Declaretypes(_:owner:) message.

Return Value

true if the data was written successfully, otherwise false if ownership of the pasteboard has changed. Any other error raises an NSPasteboardCommunicationException.

See Also

Related Documentation

Writing data