---
title: "loadItem(forTypeIdentifier:options:completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsitemprovider/loaditem(fortypeidentifier:options:completionhandler:)"
---

# loadItem(forTypeIdentifier:options:completionHandler:)

Loads the item’s data and coerces it to the specified type.

## Declaration

```swift
func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil, completionHandler: NSItemProvider.CompletionHandler? = nil)
```

```swift
func loadItem(forTypeIdentifier typeIdentifier: String, options: [AnyHashable : Any]? = nil) async throws -> any NSSecureCoding
```

## Parameters

- `typeIdentifier`: A string that represents the desired UTI.
- `options`: A dictionary of keys and values that provide information about the item, such as the size of an image. (See doc://com.apple.foundation/documentation/Foundation/NSItemProviderPreferredImageSizeKey for a key you can use.)
- `completionHandler`: A completion handler block to execute with the results. For information about the format of this block, see doc://com.apple.foundation/documentation/Foundation/NSItemProvider/CompletionHandler.

## Discussion

Discussion Call this method when you want to retrieve the item provider’s data. If the item provider object is able to provide data in the requested type, it does so and asynchronously executes your completionHandler block with the results. The block may be executed on a background thread. The type information for the first parameter of your completionHandler block should be set to the class of the expected type. For example, when requesting text data, you might set the type of the first parameter to NSString or NSAttributedString. An item provider can perform simple type conversions of the data to the class you specify, such as from NSURL to NSData or FileWrapper, or from NSData to UIImage (in iOS) or NSImage (in macOS). If the data could not be retrieved or coerced to the specified class, an error is passed to the completion block’s.

## See Also

### Loading the provider’s contents

- [loadDataRepresentation(forTypeIdentifier:completionHandler:)](foundation/nsitemprovider/loaddatarepresentation(fortypeidentifier:completionhandler:).md)
- [loadDataRepresentation(for:completionHandler:)](foundation/nsitemprovider/loaddatarepresentation(for:completionhandler:).md)
- [loadFileRepresentation(forTypeIdentifier:completionHandler:)](foundation/nsitemprovider/loadfilerepresentation(fortypeidentifier:completionhandler:).md)
- [loadFileRepresentation(for:openInPlace:completionHandler:)](foundation/nsitemprovider/loadfilerepresentation(for:openinplace:completionhandler:).md)
- [loadInPlaceFileRepresentation(forTypeIdentifier:completionHandler:)](foundation/nsitemprovider/loadinplacefilerepresentation(fortypeidentifier:completionhandler:).md)
- [loadObject(ofClass:completionHandler:)](foundation/nsitemprovider/loadobject(ofclass:completionhandler:)-8ak5d.md)
- [loadObject(ofClass:completionHandler:)](foundation/nsitemprovider/loadobject(ofclass:completionhandler:)-6pysm.md)
- [loadTransferable(type:completionHandler:)](foundation/nsitemprovider/loadtransferable(type:completionhandler:).md)
