It's great that :compose-multiplatform: Compose fo...
# compose
d
It's great that K Compose for Desktop gives us out-of-the-box SVG rendering support now, and unfortunate that the same direct support doesn't exist for Android 😞 . Those who are using SVG across multiple platforms including Android, what does your solution look like? In a recent project, I wrapped the
SVGView
from Caverock's AndroidSVG library. It was last updated in 2019 but works well, wrapped in an `AndroidView`; no complaints! I might do that again, but interested to hear alternatives?
c
You can also use Coil’s SVG support.
👍 2
j
I just transform the svg to vector drawable and I use it from a common function in desktop and android
e
I think https://github.com/flutter/flutter/issues/1831 will be interesting to watch as whatever is good for Flutter will probably be good for Compose too (both targeting Skia)
👀 1
d
A nice fast binary format (read: not XML) for simple vectors that works across platforms would surely be welcome 👍
e
IMO, XML isn't the biggest issue; Android XML resources are all compressed at build time into what is effectively a binary stream of parse events, which cuts out a big chunk of the runtime cost on each device
but SVG has too many things that require a lot of infrastructure to support (DOM, fonts, filters, etc.) while AVD is simultaneously too limited of a subset as well as being tied to Android (attr references for gradients etc.). having a reasonably sane cross-platform vector format would definitely be great :)
d
@Csaba Kozák Thanks for your earlier suggestion to use Coil for SVG. I used this to create a cross Desktop/Android
svgPainter
function that can display an SVG loaded from MokoResources on either platform - perfect 😄
👍 1