<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BackgroundAssets",
  "identifier" : "/documentation/BackgroundAssets/AssetPackManager",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Background Assets"
    ],
    "preciseIdentifier" : "s:16BackgroundAssets16AssetPackManagerC"
  },
  "title" : "AssetPackManager"
}
-->

# AssetPackManager

An actor that manages asset packs.

```
actor AssetPackManager
```

## Overview

The first time that your code refers to the shared manager, Background Assets considers that your app is opting into automatic system management of your asset packs.

> Important: When using the asset-pack manager, make sure that you also adopt the corresponding managed extension protocol, ``doc://com.apple.backgroundassets/documentation/BackgroundAssets/ManagedDownloaderExtension`` (for self-hosted asset packs) or `StoreDownloaderExtension` from StoreKit (for Apple-hosted asset packs). Not doing so is a programmer error.

## Topics

### Getting the shared manager

[`static let shared: AssetPackManager`](/documentation/BackgroundAssets/AssetPackManager/shared)

The shared manager.

### Tracking downloads

[`let statusUpdates: some Sendable & AsyncSequence<AssetPackManager.DownloadStatusUpdate, Never>`](/documentation/BackgroundAssets/AssetPackManager/statusUpdates)

An asynchronous sequence of download-status updates for all asset packs.

[`func statusUpdates(forAssetPackWithID: String) -> some Sendable & AsyncSequence<AssetPackManager.DownloadStatusUpdate, Never>`](/documentation/BackgroundAssets/AssetPackManager/statusUpdates(forAssetPackWithID:))

Returns an asynchronous sequence of download-status updates for the asset pack with the specified ID.

[`enum DownloadStatusUpdate`](/documentation/BackgroundAssets/AssetPackManager/DownloadStatusUpdate)

Statuses of an asset-pack download.

### Accessing asset packs

[`var manifest: AssetPackManifest`](/documentation/BackgroundAssets/AssetPackManager/manifest)

The manifest of asset packs that are available to download.

[`struct AssetPackManifest`](/documentation/BackgroundAssets/AssetPackManifest)

A manifest of asset packs that are available to download.

[`var allAssetPacks: Set<AssetPack>`](/documentation/BackgroundAssets/AssetPackManager/allAssetPacks)

The asset packs that are available to download.

[`func assetPack(withID: String) async throws -> AssetPack`](/documentation/BackgroundAssets/AssetPackManager/assetPack(withID:))

Returns the asset pack with the given ID.

### Accessing asset contents

[`func contents(at: FilePath, searchingInAssetPackWithID: String?, options: Data.ReadingOptions) throws -> Data`](/documentation/BackgroundAssets/AssetPackManager/contents(at:searchingInAssetPackWithID:options:))

Returns the contents of an asset file at the specified relative path.

[`func contents(at: FilePath, asLocalizedFor: Locale.Language, options: Data.ReadingOptions) throws -> Data`](/documentation/BackgroundAssets/AssetPackManager/contents(at:asLocalizedFor:options:))

Returns the contents of a localized asset file at the specified relative path.

[`func descriptor(for: FilePath, searchingInAssetPackWithID: String?) throws -> FileDescriptor`](/documentation/BackgroundAssets/AssetPackManager/descriptor(for:searchingInAssetPackWithID:))

Opens and returns a file descriptor for an asset file at the specified relative path.

[`func descriptor(for: FilePath, asLocalizedFor: Locale.Language) throws -> FileDescriptor`](/documentation/BackgroundAssets/AssetPackManager/descriptor(for:asLocalizedFor:))

Opens and returns a file descriptor for a localized asset file at the specified relative path.

[`func url(for: FilePath) throws -> URL`](/documentation/BackgroundAssets/AssetPackManager/url(for:))

Returns a URL for the specified relative path.

[`func url(for: FilePath, asLocalizedFor: Locale.Language) throws -> URL`](/documentation/BackgroundAssets/AssetPackManager/url(for:asLocalizedFor:))

Returns a URL for the specified relative path.

### Managing asset packs

[`func checkForUpdates() async throws -> (updatingIDs: Set<String>, removedIDs: Set<String>)`](/documentation/BackgroundAssets/AssetPackManager/checkForUpdates())

Gets the latest asset-pack information from the server, updates outdated asset packs, and removes obsolete asset packs.

[`func ensureLocalAvailability(of: AssetPack, requireLatestVersion: Bool) async throws`](/documentation/BackgroundAssets/AssetPackManager/ensureLocalAvailability(of:requireLatestVersion:))

Ensures that an asset pack is available locally, performing a download if necessary.

[`func ensureLocalAvailability(of: Set<AssetPack>, requireLatestVersions: Bool) async throws`](/documentation/BackgroundAssets/AssetPackManager/ensureLocalAvailability(of:requireLatestVersions:))

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

[`func assetPackIsAvailableLocally(withID: String) -> Bool`](/documentation/BackgroundAssets/AssetPackManager/assetPackIsAvailableLocally(withID:))

Checks whether an asset pack is available locally.

[`func status(relativeTo: AssetPack) async throws -> AssetPack.Status`](/documentation/BackgroundAssets/AssetPackManager/status(relativeTo:))

Checks the current status relative to a particular asset pack.

[`func localStatus(ofAssetPackWithID: String) async -> AssetPack.Status`](/documentation/BackgroundAssets/AssetPackManager/localStatus(ofAssetPackWithID:))

Checks an asset pack’s local status.

[`struct Status`](/documentation/BackgroundAssets/AssetPack/Status)

The status of an asset pack.

[`func remove(assetPackWithID: String) async throws`](/documentation/BackgroundAssets/AssetPackManager/remove(assetPackWithID:))

Removes the specified asset pack from the device.

[`func status(ofAssetPackWithID: String) async throws -> AssetPack.Status`](/documentation/BackgroundAssets/AssetPackManager/status(ofAssetPackWithID:))

Checks an asset pack’s status.

[`func ensureLocalAvailability(of: AssetPack) async throws`](/documentation/BackgroundAssets/AssetPackManager/ensureLocalAvailability(of:))

Ensures that the specified asset pack is available locally, performing a download if necessary.

### Inspecting language support

[`var locallyAvailableLanguages: [Locale.Language]`](/documentation/BackgroundAssets/AssetPackManager/locallyAvailableLanguages)

The languages used by asset packs that are localized and are available locally.

[`var resolvedLanguage: Locale.Language?`](/documentation/BackgroundAssets/AssetPackManager/resolvedLanguage)

The language that best matches current preferences and for which the system automatically makes localized asset packs available locally.

[`func reconcilePreferredLanguages() async throws`](/documentation/BackgroundAssets/AssetPackManager/reconcilePreferredLanguages())

Reconciles the set of locally available asset packs with the current preferred languages.

### Handling errors

[`struct LocalAvailabilityError`](/documentation/BackgroundAssets/AssetPackManager/LocalAvailabilityError)

An error that provides information about local asset pack availability, distinguishing between successes and failures.

### Instance Methods

[`func localSize(ofAssetPackWithID: String, calculationMethod: SizeCalculationMethod) async throws -> Int64`](/documentation/BackgroundAssets/AssetPackManager/localSize(ofAssetPackWithID:calculationMethod:))

Calculates a locally available asset pack’s installation size.

[`func localVersion(ofAssetPackWithID: String) throws -> Int`](/documentation/BackgroundAssets/AssetPackManager/localVersion(ofAssetPackWithID:))

Returns a locally available asset pack’s version number.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Actor`](/documentation/Swift/Actor)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)