Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Ivan Matkov d949b7cc83
Bump versions (Kotlin, AGP, Gradle) (#5399)
4 months ago
..
.run Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
composeApp Replace loading Image from resources to AsyncImage from local files (#5299) 8 months ago
gradle Bump versions (Kotlin, AGP, Gradle) (#5399) 4 months ago
iosApp Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
nativeAndroidApp Bump versions (Kotlin, AGP, Gradle) (#5399) 4 months ago
nativeiosApp Replace loading Image from resources to AsyncImage from local files (#5299) 8 months ago
.gitignore Replace loading Image from resources to AsyncImage from local files (#5299) 8 months ago
README.md Typo fix in LazyGridImageDemo README.md (#5304) 8 months ago
build.gradle.kts Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
download_images.sh Replace loading Image from resources to AsyncImage from local files (#5299) 8 months ago
gradle.properties Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
gradlew Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
gradlew.bat Lazy Grid Image Demo with three different implementations (#5274) 8 months ago
settings.gradle.kts Lazy Grid Image Demo with three different implementations (#5274) 8 months ago

README.md

Lazy Grid Image Demo

This project demonstrates how to display a grid of images across multiple platforms: Android, iOS, and Desktop.

The project includes three different implementations of the same functionality:

  1. Kotlin Multiplatform with Compose - a shared implementation using Compose Multiplatform
  2. Native Android - a pure Android implementation using Jetpack Compose
  3. Native iOS - a pure iOS implementation using SwiftUI

The application displays 999 images in a LazyVerticalGrid (or equivalent on each platform) with 3 columns. The images are loaded asynchronously from local resources:

  • In the Compose Multiplatform version, images are loaded using Coil library from the Compose Multiplatform resources
  • In the native Android version, images are loaded using Coil library from the Android assets
  • In the native iOS version, images are loaded using AsyncImage from the local file system

The project is used to compare Compose Multiplatform performance metrics with native counter-parts such us size, startup time, FPS, CPU/GPU usage, etc.

Project Structure

  • /composeApp - Contains the Kotlin Multiplatform implementation using Compose Multiplatform

    • commonMain - Code shared across all platforms
    • androidMain - Android-specific code
    • iosMain - iOS-specific code
    • desktopMain - Desktop-specific code
  • /nativeAndroidApp - Contains a native Android implementation using Jetpack Compose

    • Uses Android's resource system to load images
  • /nativeiosApp - Contains a native iOS implementation using SwiftUI

    • Uses iOS asset catalog to load images

Downloading Images

This project includes a script to download 999 different images from Picsum Photos with 512x512 resolution:

./download_images.sh

Please run the script before building the project.

Building and Running

Compose Multiplatform App

  • For Android: Run the composeApp configuration from Android Studio
  • For iOS: Open the Xcode project in the iosApp directory
  • For Desktop: Run the desktopApp configuration from IntelliJ IDEA or Android Studio

Native Android App

  • Open the nativeAndroidApp directory in Android Studio and run the app

Native iOS App

  • Open the nativeiosApp/nativeiosApp.xcodeproj in Xcode and run the app