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 Compose Multiplatform image resources #2077

Open
colinrtwhite opened this issue Jan 24, 2024 · 2 comments
Open

Support Compose Multiplatform image resources #2077

colinrtwhite opened this issue Jan 24, 2024 · 2 comments
Labels
3.0 Relates to Coil 3.0. enhancement New feature or request help wanted Issues that are up for grabs + are good candidates for community PRs

Comments

@colinrtwhite
Copy link
Member

colinrtwhite commented Jan 24, 2024

Is your feature request related to a problem? Please describe.
We should add support to load Compose Multiplatform image resources via Coil.

Describe the solution you'd like
I should be able to do:

AsyncImage(
  model = Res.drawable.example_icon,
  contentDescription = null,
)

Additional context
I think we're probably going to have to rely on internal semantics to load these resources in customer Fetchers for each platform (similar to how resources are included in the sample:compose app) as we can't use the generated composable functions.

This probably makes sense as an external artifact instead of being bundled with coil-compose-core as these Res classes are only necessary for Compose Multiplatform users - not Compose AndroidX users.

Open to a PR if someone wants to contribute this!

@colinrtwhite colinrtwhite added enhancement New feature or request help wanted Issues that are up for grabs + are good candidates for community PRs 3.0 Relates to Coil 3.0. labels Jan 24, 2024
@rustamsmax
Copy link

Maybe we can use custom mappers? ImageResMapper to uri

@colinrtwhite
Copy link
Member Author

We could map the Ints to Uris (similar to how we handle Android res IDs), but we'll still need a fetcher to convert the Uri into an ImageSource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 Relates to Coil 3.0. enhancement New feature or request help wanted Issues that are up for grabs + are good candidates for community PRs
Projects
None yet
Development

No branches or pull requests

2 participants