-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #427 from skydoves/docs/coil3
Update docs for coil3
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |