Use coil3 for compose multiplatform, with disk and...
# feed
k
Use coil3 for compose multiplatform, with disk and memory cache. https://proandroiddev.com/coil-for-compose-multiplatform-5745ea76356f
πŸ‘ 7
πŸ‘πŸ» 1
πŸ‘πŸΎ 1
k
I do like your sample app screenshots πŸ˜‰
k
I like your sample app πŸ˜‚
k
I would say a template app
k
i stand corrected πŸ˜› template app
a
@Kashismails the sample code on your article doesnt seem to compile here. More specifically:
Copy code
coil3.compose.AsyncImage(
        modifier = modifier,
        model =url,
        contentDescription = contentDescription,
        contentScale = contentScale,
        colorFilter = if (applyTint) ColorFilter.tint(color = tint) else null,
        onError = {
            loadingProgress(ImageState.Failure)
        },
        onLoading = {
            loadingProgress(ImageState.Loading)
        },
        onSuccess = {
            loadingProgress(ImageState.Success)
        },
  
    )
is missing the
imageLoader
parameter. using
3.0.0-alpha06
same as your article. what am i missing?
k
did you create the image loader and set this singleton?
Copy code
setSingletonImageLoaderFactory { context ->
    getAsyncImageLoader(context)
}
a
i didn't. i dont understand how that will change the signature of the function though
i'm having a look at the repo rn. it does run so there's definatelly an issue on how im doing things waiting for IDEA to index everything
k
when you create that singleton, you dont have to pass imageloader only string url works else
ImageLoader.Builder(context).crossfade(true).logger(DebugLogger()).build()
you have to pass imageloader
a
figured it out. I was missing the
io.coil-kt.coil3:coil-compose
dependency. The
AsyncImage
is available on
io.coil-kt.coil3:coil
which requires the
ImageLoader
in its parameters. The coil-compose one has overloads with default values and that's why the code wouldn't compile.
🦜 1
thanks for the article πŸ‘
🦜 1
315 Views