How do you share a svg resource between compose de...
# compose
l
How do you share a svg resource between compose desktop and android? Desktop accepts SVG just fine, but android doesnt seem to
Can you even do it? Or do you have to work with expected/actual?
j
Depends if you mean .svg file its complex as Android using VectorDrawable wrapper in XML. I think there is libraries solving this, like Coil. Not sure if Coil works with desktop though. Probably more image libraries solving similar.
Heard that Kamel should be good: https://github.com/Kamel-Media/Kamel Never tried it myself yet but probably will soon.
l
I've used kamel before, but i didnt think of it because i used it for loading from an url. I'm going to try it now, but it should work Thanks
j
Also Coil has pending work to be multiplatform soon but not yet. Using these libraries like Coil for videos, animated gifs, svg etc and in general works really good imo. Best they both supporting http based resources but also local ones.
l
Yeah coil i know doesnt support multiplatform, didnt know it was being worked on tho, very cool to know
j
https://github.com/coil-kt/coil/issues/842#issuecomment-1512239051 Used Coil since beginning like 0.1 Alpha versions. I was very early adopter. One of my personal favourite libraries. Colin White founder is amazing developer and such high quality.
l
I personally would use the SVG2Compose AS plugin to create a Compose icon from the svg. Compose icons are supported on all targets Compose supports.
j
Oh there exists plugin doing that. Compose icon is like Canvas paths or? Get me curious here :)
k
https://github.com/Skeptick/libres Supports svg on all platforms
Simple svg of course
For Android it will be converted to xml under the hood
l
@Landry Norris I cant find this plugin in Intellij 🤔
Looks like the plugin is named 'SVG to Compose'. There's a kotlin script called SVG2Compose that I think this uses under the hood.
l
😞
Kamel also doesnt have svgDecoder for android, so i guess i'll have to try Skeptick libres
185 Views