---
title: "loadPreviewImage(options:completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsitemprovider/loadpreviewimage(options:completionhandler:)"
---

# loadPreviewImage(options:completionHandler:)

Loads the preview image for the item that the item provider represents.

## Declaration

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

```swift
func loadPreviewImage(options: [AnyHashable : Any]! = [:]) async throws -> any NSSecureCoding
```

## 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 doc://com.apple.foundation/documentation/Foundation/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 doc://com.apple.foundation/documentation/Foundation/NSData, doc://com.apple.foundation/documentation/Foundation/NSURL, doc://com.apple.documentation/documentation/UIKit/UIImage (in iOS), or doc://com.apple.documentation/documentation/AppKit/NSImage (in macOS) for receiving the image data. For more information about implementing the block, see doc://com.apple.foundation/documentation/Foundation/NSItemProvider/CompletionHandler.

## Discussion

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

### Loading a preview image

- [previewImageHandler](foundation/nsitemprovider/previewimagehandler.md)
