On-Demand Resources for Lottie Animation Storage in Swift
Article Summary
Bevan Christian from IDN Engineering tackles a problem every mobile team faces: beautiful Lottie animations that bloat your app size. His solution? On-Demand Resources that cut initial download size while keeping the polish.
This technical guide walks through implementing Apple's On-Demand Resources feature to host Lottie animations separately from your main app bundle. Bevan shares real implementation code for lazy-loading animations (like onboarding flows) only when needed, rather than forcing users to download them upfront.
Key Takeaways
- On-Demand Resources separate assets from app bundle, reducing initial download size
- Assets download only when requested, then iOS manages retention and cleanup automatically
- Implementation uses NSBundleResourceRequest with priority levels for conditional loading
- Initial install tags require TestFlight or App Store for proper testing
- Perfect for onboarding animations used once then rarely accessed again
By moving rarely-used Lottie animations to On-Demand Resources, you can ship smaller app bundles without sacrificing visual polish or user experience.
About This Article
When product teams add large animation files like 2 MB Lottie assets that only get used once during onboarding, the app size grows noticeably. This makes users hesitant to download because of storage concerns.
Bevan Christian used Apple's On-Demand Resources feature with NSBundleResourceRequest to load Lottie animations conditionally. The animations are hosted separately on the App Store and only download when users reach the onboarding flow.
Users get faster initial downloads and use less device storage. Developers can add animations without worrying about making the bundle larger or forcing users to re-download assets.