Tatsumi0000 / KMP-Multimodule-Template

KMP multimodule template 🧏

Home Page:https://blog.aespa.love/multimodule-configuration-with-kotlin-multiplatform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KMP-Multimodule-Template

This repository is a template for implementing multimodule in Kotlin Multiplatform(KMP).

tool version
Kotlin 2.0.0
org.jetbrains.compose 1.6.10
com.android.application 8.3.0

πŸ‘©β€πŸ’» How to use?

  1. Clone repository
git clone git@github.com:Tatsumi0000/KMP-Multimodule-Template.git
  1. Copy directory hoge to directory KMP project.
  2. Rename package_name and hoge folder name.
  3. Add the module include to settings.gradle.kts in the KMP project.
// settings.gradle.kts(your KMP project)
include(":hoge")
  1. Fix build.gradle.kts. (FIXME is written where corrections are needed)
  2. Load the module in the module you want to use in the build.gradle.kts in your KMP project.
// build.gradle.kts(:composeApp)
kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation(project(":hoge"))
        }
}

An example implementation can be found in this repository.

☝ Points

It appears that the directory name must contain commonMain. Class is recognized by the androidMain and iosMain packages even though it does not contain commonMain, but not by commonMain(:composeApp).

About

KMP multimodule template 🧏

https://blog.aespa.love/multimodule-configuration-with-kotlin-multiplatform

License:MIT License


Languages

Language:Kotlin 100.0%