Mac Developer Library

Developer

NSPasteboardItemDataProvider Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSPasteboardItemDataProvider

Inheritance


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.6 and later.

This protocol is implemented by the data provider of a pasteboard item to provide the data for a particular UTI type.

You can specify an object as a pasteboard data provider for a pasteboard item using NSPasteboardItem’s setDataProvider:forTypes: method. The data provider must implement this protocol to provide data upon request.

  • Asks the receiver to provide data for a specified type to a given pasteboard. (required)

    Declaration

    Swift

    func pasteboard(_ pasteboard: NSPasteboard!, item item: NSPasteboardItem!, provideDataForType type: String!)

    Objective-C

    - (void)pasteboard:(NSPasteboard *)pasteboard item:(NSPasteboardItem *)item provideDataForType:(NSString *)type

    Parameters

    pasteboard

    A pasteboard to which the receiver has promised to provide data.

    item

    A pasteboard item for which the receiver has promised to provide data

    type

    A UTI type string.

    Discussion

    The receiver was previously set as the provider using setDataProvider:forTypes:.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Informs the receiver that the pasteboard no longer needs the data provider for any of its pasteboard items.

    Declaration

    Swift

    optional func pasteboardFinishedWithDataProvider(_ pasteboard: NSPasteboard!)

    Objective-C

    - (void)pasteboardFinishedWithDataProvider:(NSPasteboard *)pasteboard

    Parameters

    pasteboard

    A pasteboard.

    Discussion

    One data provider can provide data for more than one pasteboard item. This method is called when the pasteboard no longer needs the data provider for any of its pasteboard items. This can be either because the data provider has fulfilled all promises, or because ownership of the pasteboard has changed.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.