Skip to content

Commit

Permalink
Merge pull request #427 from skydoves/docs/coil3
Browse files Browse the repository at this point in the history
Update docs for coil3
  • Loading branch information
skydoves authored Feb 5, 2024
2 parents 9df6add + 2f9ac3e commit 73b6409
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,29 @@ CompositionLocalProvider(LocalGlideRequestOptions provides requestOptions) {
</div>

[![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)<br>

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
Expand All @@ -219,6 +235,7 @@ CoilImage(
```
### More Details for CoilImage
<details>
<summary>👉 Read further for more details</summary>
Expand Down
62 changes: 62 additions & 0 deletions docs/coil3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<div class="header">
<a href="https://github.com/coil-kt/coil" target="_blank"> <img src="https://user-images.githubusercontent.com/24237865/95545538-1cf27f00-0a39-11eb-83dd-ef9b8c6a74cb.png" align="left" width="6%" alt="Fresco" /></a>
<h1>Landscapist Coil3</h1>
</div>

[![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)<br>

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)

0 comments on commit 73b6409

Please sign in to comment.