This project is a simple image caching application that loads images from the network and caches them in memory.
Supported platforms: Android, iOS.
- JDK 17 or higher on your machine
- Android Studio Iguana 2023.2.1 or higher
- Kotlin Multiplatform Mobile plugin installed in Android Studio
local.properties
file set a path to Android SDK- To run the application on iOS, you need to have Xcode installed on your machine.
- I created a separate
imageCaching
module for image caching logic to make it reusable for other projects. - The project is built with Kotlin Multiplatform Mobile (KMM) and uses Jetpack Compose for UI.
- The project is divided into 4 modules:
imageCaching
- This is Image Caching shared module library that contains the core logic of the image cachingimageCaching/commonMain
- Shared code for Android and iOS,imageCaching/androidMain
- Android Image Decoder,imageCaching/iosMain
- iOS Image Decoder .
composeApp/commonMain
- Shared app code for Android and iOS,composeApp/androidApp
- Android specific code,iosApp
- iOS specific code.
- CLEAN & MVVM architecture pattern.
- SOLID Principles.
- The project uses Kotlin Coroutines for asynchronous programming.
- Repository pattern is used to abstract the data layer.
- Kotlin Multiplatform Mobile
- Jetpack Compose
- Ktor
- Koin
- StateFlow
- Kotlin Coroutines
- Kotlin Serialization
- StateHoisting
- Expect and Actual
- The application loads images from the network and caches them in memory.
- The application displays a grid of images.
- Network error handling and retry mechanism.
- Image loading indicator.
- Image placeholder.
- The project contains compose unit tests for the composeApp module.
Android
- To Run simulator UI tests:./gradlew :composeApp:pixel5Check
iOS
- To Run simulator UI tests:./gradlew :composeApp:iosSimulatorArm64Test
- To build, run
./gradlew :composeApp:assembleDebug
- find
.apk
file incomposeApp/build/outputs/apk/debug/composeApp-debug.apk
- Android simulator UI tests, run
./gradlew :composeApp:pixel5Check
- Android Screenshot
- To run,
iosApp/iosApp.xcproject
in Xcode and run standard configuration - iOS simulator UI tests:
./gradlew :composeApp:iosSimulatorArm64Test
- iOS Screenshot
- Unsplash loads maximum 30 images on each request, so the gallery will show only 30 images.
- As of now the application does not have a pagination feature.
- API Key is hardcoded in the project, it should be stored in a secure place. If I would have not kept in the project, you would not be able to run the project directly.