---
title: NSItemProvider.LoadHandler
framework: foundation
role: symbol
role_heading: Type Alias
path: foundation/nsitemprovider/loadhandler
---

# NSItemProvider.LoadHandler

A block that loads the item provider’s data and coerces it to the specified type.

## Declaration

```swift
typealias LoadHandler = @Sendable (NSItemProvider.CompletionHandler?, AnyClass?, [AnyHashable : Any]?) -> Void
```

## Discussion

Discussion Use this block when registering a type-specific coercion handler with the registerItem(forTypeIdentifier:loadHandler:) method. The parameters for this block are as follows: When a client calls the loadItem(forTypeIdentifier:options:completionHandler:) method and requests the appropriate type, the item provider executes your block. In your implementation, create an object of the expected type and execute the block in the completionHandler parameter, passing the newly created object as the first parameter of that block. If there is an error, pass nil for the object and provide an appropriate NSError object explaining what happened. This type of block is also used for generating preview images. In the case of a preview image, the expectedValueClass is always a NSData, NSURL, UIImage (in iOS), or NSImage (in macOS) class.

## See Also

### Constants

- [NSItemProvider.CompletionHandler](foundation/nsitemprovider/completionhandler.md)
- [Options Dictionary Key](foundation/options-dictionary-key.md)
- [Keys for Items Accessed in JavaScript Code](foundation/keys-for-items-accessed-in-javascript-code.md)
- [errorDomain](foundation/nsitemprovider/errordomain.md)
- [NSItemProviderFileOptions](foundation/nsitemproviderfileoptions.md)
- [NSItemProviderReading](foundation/nsitemproviderreading.md)
- [NSItemProviderWriting](foundation/nsitemproviderwriting.md)
- [NSItemProviderRepresentationVisibility](foundation/nsitemproviderrepresentationvisibility.md)
- [NSItemProvider.ErrorCode](foundation/nsitemprovider/errorcode.md)
