Contents

ensureLocalAvailability(of:requireLatestVersions:)

Ensures the specified asset packs are available locally, performing a batch download if necessary.

Declaration

func ensureLocalAvailability(of assetPacks: Set<AssetPack>, requireLatestVersions shouldUpdate: Bool = false) async throws

Parameters

  • assetPacks:

    The asset packs the local availability of which to ensure.

  • shouldUpdate:

    Whether to require that the respective latest versions be available locally. When true is passed to this parameter, the method will wait for the updates (if there indeed are any available) to be downloaded before returning. When false is passed, the method won’t check for updates and won’t attempt to download any.

Mentioned in

Discussion

This method checks whether the asset packs are currently downloaded. If any aren’t, then the system schedules them to be downloaded and waits for all of the downloads to finish. The framework guarantees that the requested asset packs are available locally after this method returns without throwing. If the method throws, then the asset packs aren’t all guaranteed to be available locally, though some might be; inspect the thrown error for more details. You can optionally monitor download progress by awaiting status updates from statusUpdates or statusUpdates(forAssetPackWithID:) in a separate task.

See Also

Managing asset packs