Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compile-safe Compose Multiplatform Resources #2812

Open
colinrtwhite opened this issue Jan 26, 2025 · 1 comment
Open

Support compile-safe Compose Multiplatform Resources #2812

colinrtwhite opened this issue Jan 26, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@colinrtwhite
Copy link
Member

Is your feature request related to a problem? Please describe.
Add support for compile-safe Compose Multiplatform Resources like Res.drawable.sample. Currently we only support loading them via Res.getUri("drawable/sample.jpg").

Additional context
Previously this wasn't possible as there was missing API support, but Compose Multiplatform now has public rememberResourceEnvironment and getDrawableResourceBytes functions, which should make adding support for this possible.

It's not 100% straightforward to add this as we can't access these functions from coil-compose-core, as depending on the resource library would add it as a dependency for all users. Ideally we'd be able to reference them in coil-compose-core as that's where we have access to the composition. Instead we'll probably have to make an extension library and add hooks to pass the ResourceEnvironment through to a custom Fetcher.

@colinrtwhite colinrtwhite added the enhancement New feature or request label Jan 26, 2025
@bpappin
Copy link

bpappin commented Jan 28, 2025

how do I vote for this?

@colinrtwhite colinrtwhite changed the title Support compile-safe Compose Multiplatform Resource Support compile-safe Compose Multiplatform Resources Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants