Hello, is there a way to transform a string to a r...
# compose
l
Hello, is there a way to transform a string to a resource for example "Icons.Rounded.Settings".toImageVector() would returns Icons.Rounded.Settings?
not sure it's especially compose channel but it's about compose icons so...
z
What’s your use case for wanting this? Server driven UI?
z
You could parse the string then use reflection to look up the members. But i wouldn’t recommend doing this: it’s brittle and slow due to reflection. Instead hard-code the mapping of names to icons that you need.
l
Yeah @Zun exactly this
@Zach Klippenstein (he/him) [MOD] I thought about this but wondering if there was a better way, thanks anyway 🙏