Protocol

NSPasteboardReading

A set of methods that defines the interface for initializing an object from a pasteboard.

Overview

The Cocoa framework classes NSString, NSAttributedString, NSURL, NSColor, NSSound, NSImage, and NSPasteboardItem implement this protocol. You can make your custom class conform to this protocol so that you can read instances from a pasteboard using the readObjects(forClasses:options:) method of NSPasteboard.

Topics

Initializing the Pasteboard

init?(pasteboardPropertyList: Any, ofType: NSPasteboard.PasteboardType)

Initializes an instance with a property list object and a type string.

Required.

Reading From the Pasteboard

static func readableTypes(for: NSPasteboard)

Returns an array of UTI strings of data types the receiver can read from the pasteboard and be initialized from.

Required.

static func readingOptions(forType: NSPasteboard.PasteboardType, pasteboard: NSPasteboard)

Returns options for reading data of a specified type from a given pasteboard.

Constants

struct NSPasteboard.ReadingOptions

Options to specify how data on the pasteboard should be interpreted to initialize an object in init(pasteboardPropertyList:ofType:).

See Also

Pasteboard

class NSPasteboard

An object that transfers data to and from the pasteboard server.

class NSPasteboardItem

An item on a pasteboard.

protocol NSPasteboardWriting

A set of methods that defines the interface for retrieving a representation of an object that can be written to a pasteboard.

protocol NSPasteboardItemDataProvider

A set of methods implemented by the data provider of a pasteboard item to provide the data for a particular UTI type.