Images
Live Activities have strict size limits (4KB per update), making image handling a critical optimization area. Voltra provides three different approaches for including images in your Live Activities, each with different trade-offs and use cases:
- Base64 encoding: Best for small, static images (< 1KB)
- Build-time asset copying: Best for medium-sized images that are known at build time
- Runtime preloading: Best for dynamic images from remote URLs or inline SVG data
Base64 encoding
For extremely small images, you can embed them directly as base64-encoded strings in your JSX.
Build-time asset copying
Place images in the /assets/voltra/ directory and they'll be automatically copied to the iOS extension bundle during build.
Here's how build-time asset copying works:
- Images in
/assets/voltra/are automatically detected during build - Each image is validated to be under 4KB (ActivityKit limit)
- Images are copied to the Live Activity extension's
Assets.xcassets - Xcode generates proper
.imagesetdirectories and metadata
You can then reference these images using their assetName:
Runtime preloading
For dynamic images from remote URLs or inline SVG markup, use Voltra's image preloading API to cache images in App Group shared storage. SVG inputs are rasterized to PNG before storage.
The image preloading system works by:
- Downloading images from URLs to App Group shared storage
- Validating that images are under the 4KB ActivityKit limit
- Making images available to Live Activities via the
assetNameproperty - Providing APIs to reload existing Live Activities when new images are available
Once images are preloaded, reference them using the assetName property:
For detailed API documentation, see Image Preloading.
