Hi, when i tried to use Coil image to load SVG, it...
# compose-ios
f
Hi, when i tried to use Coil image to load SVG, it throws this error in my log: can't render image: load image failed i already installed SvgDecoderFactory but it wont load ? But it loads just fine on android platform. Does anyone knows how to solve this ? thank you.
Turns out the SVG image have PNG image embedded in it, but not sure why it fails to load on non Android platform ?
Then i decided to extract the base64 from the svg and then use toImageBitmap extension function to load the Image
g
I have this same issue with coil 3.3 in my CMP project. I have the ktor darwin client lib in my appleMain.dependencies, I've included the coil and coil-svg library in commonMain.dependencies, I even added the SvgDecoder.Factory() to the ImageLoader. Android loads the svg with no problems, but I get 'can't render image: load image failed' in iOS. If I switch the file for a png file, it loads with coil with no problems on both platforms.
Ah, it looks like iOS can't handle base64 encoded svg files via coil. I found another svg file that doesn't just base64 encode a png and that worked fine on both platforms. Weird that it does work on Android. 🤔
f
yes it does works on android but not on ios, strange haha, i ended up implementing my own logic, thanks to gpt as well haha