---
title: "requestAssets(completionHandler:)"
framework: Natural Language
role: symbol
role_heading: Instance Method
platforms: [iOS 17.0+, iPadOS 17.0+, Mac Catalyst 17.0+, macOS 14.0+, tvOS 17.0+, visionOS 1.0+, watchOS 10.0+]
path: "naturallanguage/nlcontextualembedding/requestassets(completionhandler:)"
---

# requestAssets(completionHandler:)

Requests embedding model assets and downloads them if available.

## Declaration

```swift
func requestAssets(completionHandler: @escaping @Sendable (NLContextualEmbedding.AssetsResult, (any Error)?) -> Void)
```

```swift
func requestAssets() async throws -> NLContextualEmbedding.AssetsResult
```

## Parameters

- `completionHandler`: A closure that notifies your app when the asset request completes.

## Asynchronous alternative

Asynchronous alternative You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func requestAssets() async throws -> NLContextualEmbedding.AssetsResult For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Discussion You use a contextual embedding after loading the necessary assets onto the device. Use hasAvailableAssets to determine whether assets are available. This method returns immediately if the framework knows the state of the assets or if an error occurs.

## See Also

### Requesting assets

- [NLContextualEmbedding.AssetsResult](naturallanguage/nlcontextualembedding/assetsresult.md)
