Add the dependency below to your module's build.gradle
file:
dependencies {
implementation "com.github.skydoves:landscapist-coil:$version"
}
dependencies {
implementation("com.github.skydoves:landscapist-coil:$version")
}
Note
Please make sure your project uses the same Jetpack Compose version on the release page.
CoilImage¶
You can load images by using the CoilImage
composable function as the following example below:
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, 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.