status(relativeTo:)
Checks the current status relative to a particular asset pack.
Declaration
func status(relativeTo assetPack: AssetPack) async throws -> AssetPack.StatusParameters
- assetPack:
The asset pack.
Return Value
The asset pack’s status.
Discussion
This method checks whether any version of the specified asset pack is currently downloaded. If one is, then it determines the version relationship between the downloaded asset pack and the specified asset pack. If they have different version numbers, then the returned status value will contain outOfDate. The returned status value will contain updateAvailable only if the relevant asset pack on the server hasn’t been further updated since the initialization of the provided AssetPack instance.
For example, consider the following sequence of events, assuming that version 1 of the relevant asset pack is already available locally:
Your app calls assetPack(withID:) to obtain an AssetPack instance.
The asset pack is updated to version 2 on the server.
Your app calls this method, passing the AssetPack instance from step 1.
In this case, the returned status value will indicate that the downloaded asset pack is up to date. Generally, you shouldn’t need to handle this type of situation explicitly because the system automatically polls for updates periodically in the background.
This method doesn’t automatically trigger any downloads, updates, or removals.