Raka M.A
Raka M.A

Reputation: 255

Create another module in Compose Multiplatform Project

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

Upvotes: 5

Views: 3902

Answers (3)

Alok Singh
Alok Singh

Reputation: 163

To see the Kotlin Multiplatform Shared Module option while creating modules you need to enable Experimental Multiplatform IDE Feature.

To enable go to Setting > Advance Setting > enable "Experimental Multiplatform IDE Feature"

Upvotes: 12

Bhavya Sikka
Bhavya Sikka

Reputation: 11

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

Upvotes: 1

Rafsanjani
Rafsanjani

Reputation: 5443

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.

Upvotes: 0

Related Questions