Hey everyone, I have question about resources. So ...
# compose-ios
k
Hey everyone, I have question about resources. So I have been using this way to access my assets so far
Copy code
Image(
  painter = painterResource("mylogo.png"),
  contentDescription = null
)
It has been working just fine, until I tried to import this library (peekaboo : https://github.com/onseok/peekaboo) . And above line start complaining, and from i see the signature of painterResources has changed to requires DrawableResources type instead of just String. From what i understand this seems like the new way of accessing assets, I tried to create
composeResources
folder and move my pngs there, but no
Res
type generated for me. 😞 And the other problem is, I am currently using another library that has the old way of accessing resources (
painterResource(String)
). Any suggestions how to workaround this issue?
v
Hi Khairil! Are you using
composeMultiplatform
1.6.0
or above?
k
I am using 1.6.4
Woops that is my Compose UI version..
the compose multiplatform is 1.5.12
v
Well resources were completely revamped and you will need to upgrade to
1.6.0
or
1.6.1
to have the
DrawableResource
be generated
👍 1
k
hm okay, then it will break the other library that I am using right? since currently that library still using the painterResource(string)..
v
Oh, I get it. I'm not too sure. I would upgrade and then try for the older library with
drawable:mylogo.png
k
but yeah thanks for pointing out about the versioning ... will try to upgrade.
@Vlad Mircan sorry one more question. How do you trigger code generation after adding new image?
v
You need to rebuild. And the resources will only be available inside the shared module
k
cool, thank you! have a great weekend! 🙂
v
If there's anything else don't hesitate to reach out
❤️ 1