Hello! 👋 How would you display images as UIImage in iosMain using composeResources library? I’ve tried using this, but with no luck, I always get image null
(Obviously I've created composeResources folder with the same structure as composeApp)
But I guess it's only for having custom resources in compose?
But what about if I want to display UIimage from my iosMain code?
s
sigmadelta
10/21/2024, 7:06 AM
I don't think you'll be able to address the resources directly from the iOS part. Top of my head I would likely read out the imageresource into a byte array, convert the
KotlinByteArray
to
NSData
and then visualize this with a
UIImage
.
🙏 1
f
François
10/21/2024, 7:43 AM
UIImage.imageNamed("image_name")
is loading only asset stored inside the xcasset folder.
v
Vytenis
10/21/2024, 7:44 AM
Tried to store the .png file there as well, but got null too.
f
François
10/21/2024, 7:49 AM
The solution of Bojan is working, you need to do some conversion.