Instance Method

data(forPasteboardType:)

Returns the data in the pasteboard for the given representation type.

Declaration

func data(forPasteboardType pasteboardType: String) -> Data?

Parameters

pasteboardType

A string identifying a representation type of a pasteboard item.

Return Value

A data object or nil if there is no data in the pasteboard of the given type.

Discussion

The returned object often holds raw (binary) data, such as image data. This method works on the first item in the pasteboard. If there are other items, it ignores them.

See Also

Getting and Setting Single Pasteboard Items

func value(forPasteboardType: String) -> Any?

Returns an object in the pasteboard for the given representation type.

func setData(Data, forPasteboardType: String)

Puts data in the pasteboard for the specified representation type.

func setValue(Any, forPasteboardType: String)

Puts an object in the pasteboard for the specified representation type.