Instance Method

contains(pasteboardTypes:)

Returns whether the pasteboard holds data of the specified representation type.

Declaration

func contains(pasteboardTypes: [String]) -> Bool

Parameters

pasteboardTypes

An array of strings. Each string should identify a representation of the pasteboard item that the pasteboard reader can handle. These string are frequently UTIs. See the class description for more information about pasteboard item types.

Return Value

true if the pasteboard item holds data of the indicated representation type, otherwise false.

Discussion

This method works on the first item in the pasteboard. If there are other items, it ignores them. You can use this method when enabling or disabling the Paste menu command.

Starting in iOS 10, you can directly check which data types are present on a pasteboard by using the convenience methods described in Checking for Data Types on a Pasteboard.

See Also

Determining Types of Single Pasteboard Items

var types: [String]

Returns the types of the first item on the pasteboard.