Compose ImageLoader
Compose Image library for Kotlin Multiplatform.
Setup
Add the dependency in your common module's commonMain sourceSet
kotlin {
// ...
sourceSets {
val commonMain by getting {
dependencies {
api("io.github.qdsfdhvh:image-loader:$last_version")
}
}
}
}
How to Use
@Composeable
fun Content() {
CompositionLocalProvider(
LocalImageLoader provides generateImageLoader(),
) {
val url = "https://....."
val painter = rememberAsyncImagePainter(url)
Image(painter, null)
}
}
fun generateImageLoader(): ImageLoader {
return ImageLoaderBuilder().build()
}