Create another module in Compose Multiplatform Project

649 Views Asked by At

I'm currently building a project with Compose Multiplatform, and I'm wondering to make this project structured with multi-module clean architecture.

Here's my current modules:

My current modules

I'm looking for adding :core module in :composeApp module.

Add module window

But it seems no option for Compose Multiplatform regular module (yet)

How can I create module similar to :commonMain? Besides, I don't found any include(':moduleName') in settings.gradle

2

There are 2 best solutions below

1
On

commonMain isn't a module, it is a source set in your :composeApp module. This is where you write your Kotlin code without access to Java standard libraries.

If you want to create another KMM module, you should use the last option in your template Kotlin Multiplatform Shared Module. This will create a separate kmm gradle module which will also have commonMain inside of it.

0
On

You can't create a new multiplatform module inside composeApp module.

Instead you can create a new module say 'core' inside your project by selecting 'Kotlin Multiplatform Shared Module' as seen in the screenshot.

Now this 'core' module will be having all your source sets- commonMain androidMain iosMain