Class

NSFilePromiseProvider

An object that provides a promise for the pasteboard.

Declaration

class NSFilePromiseProvider : NSObject

Overview

A file promise is a possible future file of a specified type. When you're working with drag and drop, use promises to indicate intent for future action. Avoid loading or performing any actions on the file until the promise completes.

Use the NSFilePromiseProvider class when creating file promises. Instantiate one NSFilePromiseProvider for each file promised. Set the fileType and delegate properties before writing any NSFilePromiseProvider to the pasteboard. The file type must be a Uniform Type Identifier (UTI) that ultimately conforms to kUTTypeData or kUTTypeDirectory. The NSFilePromiseProviderDelegate will write the promised file to the destination directory.

Optionally, you may attach a userInfo object of your choosing to the NSFilePromiseProvider to determine which promise is being referenced when promising multiple files under the same NSFilePromiseProviderDelegate instance.

Topics

Initializers

init()

Initializes a file promise provider.

init(fileType: String, delegate: NSFilePromiseProviderDelegate)

Initializes a file promise provider for a certain file type.

Instance Properties

var fileType: String

The file type of the file promise provider.

var userInfo: Any?

Optional user information to pass to the file promise provider.

Relationships

Inherits From

See Also

File Promises

Supporting Drag and Drop Through File Promises

Receive file promises to support dragged files from other apps and provide file promises to support pasteboard operations of your app’s custom file types.

protocol NSFilePromiseProviderDelegate

A set of methods that provides the name of the promised file and writes the file to the destination directory when the file promise is fulfilled.

class NSFilePromiseReceiver

An object that receives a file promise from the pasteboard.