Contents

types

The types of the first item on the pasteboard.

Declaration

var types: [String] { get }

Return Value

An array of strings indicating the representation types of the first item on the pasteboard.

Discussion

A type is frequently, but not necessarily, a UTI (Uniform Type Identifier). It identifies a representation of the data on the pasteboard. For example, a pasteboard item could hold image data under public.png and public.tiff representations. Apps can define their own types for custom data such as com.mycompany.myapp.mytype; however, in this case, only those apps that know of the type could understand the data written to the pasteboard.

With this method, you can determine if the pasteboard holds data of a particular representation type by a line of code such as this:

BOOL pngOnPasteboard = [[pasteboard pasteboardTypes] containsObject:@"public.png"];

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 pasteboard items