Skip to content

Latest commit

 

History

History
163 lines (139 loc) · 4.66 KB

README.md

File metadata and controls

163 lines (139 loc) · 4.66 KB

Kotlin Multiplatform multi-module template for Android/iOS

This template is based on Kotlin Multiplatform and Compose Multiplatform for developing both Andorid and iOS apps. It is modularized into several feature modules and core modules, and new modules can be easily added using already defined Custom Gradle Plugins and Version Catalog. In addition, essential libraries that support multi-platforms such as coil, ktor, and koin have been added, and awesome lint tools such as spotless and detekt have already been applied in optimal configuration. Now let’s create a KMP multi-module project quickly and easily!


Support

  • Kotlin 2.1.10
  • Compose Multiplatform 1.7.1
  • AGP 8.8.0

Multi Module

Name Responsibilities
app Brings everything together required for the app to function correctly. This includes UI scaffolding and navigation.
feature:main
Functionality associated with a specific feature or user journey. Typically contains UI components and ViewModels which read data from other modules.
core:data Fetching app data from multiple sources, shared by different features.
core:designsystem Design system which includes Core UI components such as customized Material 3 components.
core:ui Composite UI components and resources used by feature modules. Unlike the designsystem module, it is dependent on the data layer since it renders models.
core:common Common classes shared between modules.
core:network Making network requests and handling responses from a remote data source.
core:datastore Storing persistent data using DataStore.
core:database Local database storage using Room.
core:model Model classes used throughout the app.

Now you can add feature modules as you want!


Dependencies

Kotlin

  • kotlinx-coroutines
  • kotlinx-datetime
  • kotlinx-serialization

Navigation

  • navigation-compose

Data

DI

Image

Lint


How to use

  1. First, modify rootProject.name on root settings.gradle.kts.
  2. Replace all dev.yjyoon.template string to your package name. (Use cmd(ctrl)+shift+R on Android Studio)
  3. Replace all template string to your project name.
  4. Rename all package directories to your package name. (You can change all package directory names at once through Android Studio)
  5. Input your name to license header on SpotlessPlugin.kt
  6. Finally, clean your project.

Gradle tasks

// format your codes with ktlint rules
./gradlew spotlessCheck
./gradlew spotlessApply

// run code static analysis with twitter compose rules
./gradlew detekt

// generate project dependency graph (need to install graphviz)
./gradlew projectDependencyGraph

References

Thanks to all the projects that helped create this template!