From 0168138c88c24917d64116b7b129215e92c037c3 Mon Sep 17 00:00:00 2001 From: skydoves Date: Mon, 5 Feb 2024 22:47:28 +0900 Subject: [PATCH 1/2] Add docs for coil3 --- docs/coil3.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 docs/coil3.md diff --git a/docs/coil3.md b/docs/coil3.md new file mode 100644 index 00000000..42cc66a7 --- /dev/null +++ b/docs/coil3.md @@ -0,0 +1,62 @@ +
+ Fresco +

Landscapist Coil3

+
+ +[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/landscapist.svg?label=Maven%20Central)](https://central.sonatype.com/search?q=skydoves%2520landscapist)
+ +Add the dependency below to your **module**'s `build.gradle` file: + +=== "Groovy" + + ```Groovy + dependencies { + implementation "com.github.skydoves:landscapist-coil3:$version" + } + ``` + +=== "KTS" + + ```kotlin + dependencies { + implementation("com.github.skydoves:landscapist-coil3:$version") + } + ``` + +If you're targeting on Kotlin Multiplatform, add the dependency below to your module's `build.gradle.kts` file: + +```kotlin +sourceSets { + val commonMain by getting { + dependencies { + implementation("com.github.skydoves:landscapist-coil3:2.3.0”) + } + } +} +``` + +The `coil3-landscapist` package functions identically to the `coil-landscapist` package, with the key distinction being its focus on Kotlin Multiplatform. This enables the use of Coil3 across various platforms, including Android, iOS, and Desktop (JVM), facilitating a unified image loading experience across different environments. + +!!! note + + Please make sure your project uses the same Jetpack Compose version on the [release page](https://github.com/skydoves/Landscapist/releases). + +### CoilImage + +You can load images by using the `CoilImage` composable function as the following example below: + +```kotlin +CoilImage( + imageModel = { imageUrl }, // loading a network image or local resource using an URL. + imageOptions = ImageOptions( + contentScale = ContentScale.Crop, + alignment = Alignment.Center + ) +) +``` + +### Compose Metrics + +According to the [Compose Compoler Metrics](https://github.com/androidx/androidx/blob/androidx-main/compose/compiler/design/compiler-metrics.md), the `CoilImage` Composable function is marked as Restartable and Skippable. This means you don't have to worry about performance issues related to re-rendering or re-fetching problems that can occur during recomposition. The Composable function's restartable and skippable nature ensures that the necessary actions are taken to optimize rendering, making it more efficient and seamless. + +![compose-metrics-coil](https://github.com/skydoves/landscapist/assets/24237865/5718a15e-07bc-4ee3-b76f-13fb09ed6d27) From 2f9ac3e28842ff4e2633c8776648d1ceb0cce28c Mon Sep 17 00:00:00 2001 From: skydoves Date: Mon, 5 Feb 2024 22:48:53 +0900 Subject: [PATCH 2/2] Update README for coil3 --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 6f6b1b52..a9e56ce1 100644 --- a/README.md +++ b/README.md @@ -196,13 +196,29 @@ CompositionLocalProvider(LocalGlideRequestOptions provides requestOptions) { [![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/landscapist.svg?label=Maven%20Central)](https://central.sonatype.com/search?q=skydoves%2520landscapist)
+ Add the dependency below to your **module**'s `build.gradle` file: + ```gradle dependencies { implementation "com.github.skydoves:landscapist-coil:$version" } ``` +If you're targeting on Kotlin Multiplatform, add the dependency below to your module's `build.gradle.kts` file: + +```kotlin +sourceSets { + val commonMain by getting { + dependencies { + implementation("com.github.skydoves:landscapist-coil3:2.3.0”) + } + } +} +``` + +The `coil3-landscapist` package functions identically to the `coil-landscapist` package, with the key distinction being its focus on Kotlin Multiplatform. This enables the use of Coil3 across various platforms, including Android, iOS, and Desktop (JVM), facilitating a unified image loading experience across different environments. + > **Note**: Please make sure your project uses the same Jetpack Compose version on the [release page](https://github.com/skydoves/Landscapist/releases). ### CoilImage @@ -219,6 +235,7 @@ CoilImage( ``` ### More Details for CoilImage +
👉 Read further for more details