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:
- Kotlin Multiplatform with Compose - a shared implementation using Compose Multiplatform
- Native Android - a pure Android implementation using Jetpack Compose
- 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
AsyncImagefrom 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 MultiplatformcommonMain- Code shared across all platformsandroidMain- Android-specific codeiosMain- iOS-specific codedesktopMain- 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
composeAppconfiguration from Android Studio - For iOS: Open the Xcode project in the
iosAppdirectory - For Desktop: Run the
desktopAppconfiguration from IntelliJ IDEA or Android Studio
Native Android App
- Open the
nativeAndroidAppdirectory in Android Studio and run the app
Native iOS App
- Open the
nativeiosApp/nativeiosApp.xcodeprojin Xcode and run the app