.riv files into your iOS, macOS, or visionOS application. This guide covers all loading methods and asset handling strategies.
Loading from App Bundle
The most common approach is to bundle.riv files with your app.
Basic Loading
Custom Bundle
Direct RiveModel Initialization
Loading from URL
HTTP/HTTPS URLs
With Animation Name
With State Machine
Handling Load State
When loading from URLs, the file downloads asynchronously:Using RiveFileDelegate
For more control over the loading process:Loading Embedded Assets
Rive files can contain embedded images, fonts, and audio. By default, these are loaded from the .riv file.Disabling CDN Loading
Custom Asset Loading
Provide your own asset loader for images and fonts:Selecting Artboards and Animations
Specific Artboard
Specific Animation
Specific State Machine
Listing Available Content
Switching Content at Runtime
Change Animation
Change Artboard
Reset to Default
Advanced Loading Patterns
Preloading Multiple Files
Lazy Loading with Error Handling
Loading Options Summary
- Bundle
- URL
- Custom Assets
Best Practices
- Bundle for Production - Include
.rivfiles in your app bundle for best performance and offline support - Handle Loading States - Show loading indicators when loading from URLs
- Error Handling - Always wrap
RiveModelinitialization in do-catch blocks - Preload When Possible - Load animations during app startup or in background threads
- Disable CDN When Not Needed - Set
loadCdn: falseif you’re providing all assets - Cache Remote Files - Implement your own caching for URL-loaded files
- Test Asset Loading - Verify custom asset loaders work with all asset types in your animations
Next Steps
- SwiftUI Guide - Using Rive with SwiftUI
- UIKit Guide - Using Rive with UIKit
- Touch Events - Handle user interactions