Coil 3.0: Image loading for Compose Multiplatform


4 screenshots of the Coil sample app on each platform

Coil 3.0 is out now with full support for Compose Multiplatform. It supports all major platforms so you can now load images on Android, iOS, JVM, JS, and WASM all with the same common API. It also has a ton of other improvements including:

  • Support for multiple networking libraries (OkHttp and Ktor). Additionally, Coil can now be used without a network dependency if you only need to load local files.
  • Support for Compose Multiplatform Resources loaded via Res.getUri.
  • Better compatibility for rememberAsyncImagePainter with Paparazzi, Roborazzi, and the Compose Preview Screenshot Testing library.
  • Enable restarting the same image request via AsyncImagePainter.restart().
  • Improve Compose @Preview rendering and support for custom preview behavior via LocalAsyncImagePreviewHandler.
  • Support for custom disk caching behavior for images loaded from the network via CacheStrategy.

Coil 3.0 uses the same API as Coil 2.0 so it’s easy to load images from the network (or elsewhere) on any platform that Compose Multiplatform supports:

AsyncImage(
    model = "https://example.com/image.jpg",
    contentDescription = null,
)

Compose Multiplatform makes it easy to build performant, shared UI apps across all major platforms - consider trying it out if you haven’t yet. Also big thanks to the Kotlin Foundation who sponsored Compose Multiplatform support for Coil last year!

Check out the full upgrade guide here and enjoy!