Skip to content

docs(ios): document global file asset loading - #936

Merged
dskuza merged 1 commit into
mainfrom
apple/global-file-assets
Sep 9, 2026
Merged

docs(ios): document global file asset loading#936
dskuza merged 1 commit into
mainfrom
apple/global-file-assets

Conversation

@dskuza

@dskuza dskuza commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Document the replacement for the legacy customLoader: create a file, inspect its assets, and register global images, fonts, or audio using each asset's uniqueName. Matching assets share the replacement across files on the same worker, even after loading.

Updates the Apple migration guide, asset-loading walkthrough and examples, and overview. Includes explicit CDN loading using asset metadata.

Validation: mint broken-links and git diff --check.

@dskuza
dskuza requested a review from a team as a code owner September 9, 2026 13:57
@mintlify

mintlify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
rive 🟢 Ready View Preview Sep 9, 2026, 2:01 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new Swift snippets in loading-assets.mdx contain documented-type vs pattern-matching inconsistencies for .unknown(UInt16) and an apparent method-call signature mismatch for removeGlobalFontAsset.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the Apple runtime documentation to explain the modern, worker-based “global asset” replacement flow for the legacy customLoader, centered on creating a File, inspecting File.getAssets() metadata, and registering replacements by asset.uniqueName (including manual CDN loading via cdn metadata).

Changes:

  • Expands the Apple “Loading Assets” page with an end-to-end workflow (discover → load bytes → decode → register) plus hosted/CDN asset fetching guidance.
  • Updates the Apple legacy migration guide to show the File.getAssets() replacement pattern and clarifies automatic CDN loading differences.
  • Refreshes the Apple overview’s Worker section to reference the new asset inspection/registration model.
File summaries
File Description
runtimes/apple/migrating-from-legacy.mdx Reframes customLoader migration guidance around File.getAssets() + global asset registration and clarifies CDN behavior.
runtimes/apple/loading-assets.mdx Introduces detailed asset discovery/metadata reference, complete examples, hosted asset loading, and global asset management guidance.
runtimes/apple/apple.mdx Updates Worker overview text to point readers to File.getAssets() and uniqueName-keyed global assets.
Review details

Suppressed comments (4)

runtimes/apple/loading-assets.mdx:93

  • The switch over asset.type uses case .unknown:. If .unknown carries a UInt16 as documented above, this needs to be case .unknown(_): to compile.
                switch asset.type {
                case .image:
                    let image = try await worker.decodeImage(from: data)
                    worker.addGlobalImageAsset(image, name: asset.uniqueName)
                case .font:
                    let font = try await worker.decodeFont(from: data)
                    worker.addGlobalFontAsset(font, name: asset.uniqueName)
                case .audio:
                    let audio = try await worker.decodeAudio(from: data)
                    worker.addGlobalAudioAsset(audio, name: asset.uniqueName)
                case .unknown:
                    break
                }

runtimes/apple/loading-assets.mdx:113

  • Same as earlier: if case .unknown = asset.type won’t compile if .unknown has an associated UInt16 as documented. Use .unknown(_) in the pattern.
            for asset in try await file.getAssets() {
                if case .unknown = asset.type { continue }
                guard let url = Bundle.main.url(

runtimes/apple/loading-assets.mdx:134

  • Same as earlier: case .unknown: should be case .unknown(_): if .unknown has an associated value (as documented in the metadata table).
                switch asset.type {
                case .image:
                    let image = try await worker.decodeImage(from: data)
                    worker.addGlobalImageAsset(image, name: asset.uniqueName)
                case .font:
                    let font = try await worker.decodeFont(from: data)
                    worker.addGlobalFontAsset(font, name: asset.uniqueName)
                case .audio:
                    let audio = try await worker.decodeAudio(from: data)
                    worker.addGlobalAudioAsset(audio, name: asset.uniqueName)
                case .unknown:
                    break
                }

runtimes/apple/loading-assets.mdx:172

  • The font removal call is missing the external parameter label, unlike the image/audio variants shown above. For consistency (and typical Swift API shape), it should likely be removeGlobalFontAsset(name:).
        worker.removeGlobalImageAsset(name: imageAsset.uniqueName)
        worker.removeGlobalFontAsset(fontAsset.uniqueName)
        worker.removeGlobalAudioAsset(name: audioAsset.uniqueName)
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread runtimes/apple/loading-assets.mdx
@dskuza
dskuza enabled auto-merge (squash) September 9, 2026 20:53
@dskuza
dskuza merged commit 2f5c9ca into main Sep 9, 2026
3 checks passed
@dskuza
dskuza deleted the apple/global-file-assets branch September 9, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants