https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
k

khairil.ushan

03/30/2024, 9:39 AM
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

Vlad Mircan

03/30/2024, 10:19 AM
Hi Khairil! Are you using
composeMultiplatform
1.6.0
or above?
k

khairil.ushan

03/30/2024, 10:20 AM
I am using 1.6.4
Woops that is my Compose UI version..
the compose multiplatform is 1.5.12
v

Vlad Mircan

03/30/2024, 10:23 AM
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

khairil.ushan

03/30/2024, 10:25 AM
hm okay, then it will break the other library that I am using right? since currently that library still using the painterResource(string)..
v

Vlad Mircan

03/30/2024, 10:28 AM
Oh, I get it. I'm not too sure. I would upgrade and then try for the older library with
drawable:mylogo.png
k

khairil.ushan

03/30/2024, 10:29 AM
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

Vlad Mircan

03/30/2024, 10:55 AM
You need to rebuild. And the resources will only be available inside the shared module
k

khairil.ushan

03/30/2024, 10:56 AM
cool, thank you! have a great weekend! 🙂
v

Vlad Mircan

03/30/2024, 10:57 AM
If there's anything else don't hesitate to reach out
❤️ 1
5 Views