Contents

setString(_:forType:)

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

Declaration

func setString(_ string: String, forType dataType: NSPasteboard.PasteboardType) -> Bool

Parameters

  • string:

    The string to write to the pasteboard.

  • dataType:

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

Mentioned in

Return Value

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

Discussion

This method invokes setData(_:forType:) to perform the write.

See Also

Related Documentation

Writing data