Instance Method

loadPreviewImage(options:completionHandler:)

Loads the preview image for the item that is represented by the item provider.

Declaration

func loadPreviewImage(options: [AnyHashable : Any]! = [:], completionHandler: NSItemProvider.CompletionHandler!)

Parameters

options

A dictionary of keys and values that provide information about the item, such as the size of an image. For a list of possible keys, see Options Dictionary Key.

completionHandler

A completion handler block to execute with the results. The first parameter of this block must be a parameter of type NSData, NSURL, UIImage (in iOS), or NSImage (in macOS) for receiving the image data. For more information about implementing the block, see NSItemProvider.CompletionHandler.

Discussion

To handle image preview yourself, provide a completion handler block that returns an NSData or NSURL object, or an instance of a platform-specific image class (UIImage or NSImage).

This method supports implicit type coercion for the item parameter of the completion block.

See Also

Generating a Preview Image

var previewImageHandler: NSItemProvider.LoadHandler?

The custom preview image handler block for the item provider.