to Coil Model
Resolves the DsImages asset to a platform-specific model suitable for third-party image loading libraries (such as Coil, Kamel, etc.) without introducing direct library dependencies into the design system.
Platform-Specific Behaviors:
Android: Resolves dynamically from the active theme using the local context to return the underlying raw drawable resource ID (Int). Since Coil natively supports resource IDs, this is highly efficient, has virtually zero CPU/memory overhead, and integrates perfectly with Android's native caching.
iOS: Loads the asset from the dynamic design system bundle as a native
UIImage, and serializes it into a raw, lossless PNG ByteArray so that Coil 3's Skia rendering engine can natively decode and display it.
⚠️ iOS Performance & Vector Trade-offs:
Redundant Pipeline: Serializing a
UIImageinto PNG bytes (UIImagePNGRepresentation), copying the memory across the cinterop bridge viamemcpy, and then having Coil decode it back into Skia pixels incurs significant CPU and memory overhead.Rasterization: Converting vector-based assets (e.g. PDF/SVG assets in the asset catalog) to PNG bytes rasterizes them to a fixed pixel resolution, losing crisp vector scalability on zoom/scale.
Recommendation: Always prefer the native DsImage composable for local assets whenever possible. It renders the image natively via a
UIImageViewusing UIKit interop, bypassing Skia entirely to achieve zero copy overhead and full crisp vector support.
Resolves the DsImages asset to a platform-specific model suitable for third-party image loading libraries (such as Coil, Kamel, etc.) without introducing direct library dependencies into the design system.
Platform-Specific Behaviors:
Android: Resolves dynamically from the active theme using the local context to return the underlying raw drawable resource ID (Int). Since Coil natively supports resource IDs, this is highly efficient, has virtually zero CPU/memory overhead, and integrates perfectly with Android's native caching.
iOS: Loads the asset from the dynamic design system bundle as a native
UIImage, and serializes it into a raw, lossless PNG ByteArray so that Coil 3's Skia rendering engine can natively decode and display it.
⚠️ iOS Performance & Vector Trade-offs:
Redundant Pipeline: Serializing a
UIImageinto PNG bytes (UIImagePNGRepresentation), copying the memory across the cinterop bridge viamemcpy, and then having Coil decode it back into Skia pixels incurs significant CPU and memory overhead.Rasterization: Converting vector-based assets (e.g. PDF/SVG assets in the asset catalog) to PNG bytes rasterizes them to a fixed pixel resolution, losing crisp vector scalability on zoom/scale.
Recommendation: Always prefer the native DsImage composable for local assets whenever possible. It renders the image natively via a
UIImageViewusing UIKit interop, bypassing Skia entirely to achieve zero copy overhead and full crisp vector support.
Resolves the DsImages asset to a platform-specific model suitable for third-party image loading libraries (such as Coil, Kamel, etc.) without introducing direct library dependencies into the design system.
Platform-Specific Behaviors:
Android: Resolves dynamically from the active theme using the local context to return the underlying raw drawable resource ID (Int). Since Coil natively supports resource IDs, this is highly efficient, has virtually zero CPU/memory overhead, and integrates perfectly with Android's native caching.
iOS: Loads the asset from the dynamic design system bundle as a native
UIImage, and serializes it into a raw, lossless PNG ByteArray so that Coil 3's Skia rendering engine can natively decode and display it.
⚠️ iOS Performance & Vector Trade-offs:
Redundant Pipeline: Serializing a
UIImageinto PNG bytes (UIImagePNGRepresentation), copying the memory across the cinterop bridge viamemcpy, and then having Coil decode it back into Skia pixels incurs significant CPU and memory overhead.Rasterization: Converting vector-based assets (e.g. PDF/SVG assets in the asset catalog) to PNG bytes rasterizes them to a fixed pixel resolution, losing crisp vector scalability on zoom/scale.
Recommendation: Always prefer the native DsImage composable for local assets whenever possible. It renders the image natively via a
UIImageViewusing UIKit interop, bypassing Skia entirely to achieve zero copy overhead and full crisp vector support.