Nikhil Bansal
07/25/2025, 5:54 AMcommonMain
, androidMain
, iosMain
folders in both :shared
and :composeApp
modules. Shouldn't these be only in :shared
module? This does not happen when I am not sharing UI.
2. When generating project without sharing UI, the org.jetbrains.kotlin.multiplatform
plugin is applied in the build.gradle.kts
of :composeApp
as well. Is it required? I can see only androidMain
folder in the :composeApp
module. Why do we need KMP plugin for android module when not sharing UI?zsmb
07/25/2025, 6:55 AMshared
module created).
The readme describes the purpose of composeApp
and `shared`:
```*is for code that will be shared across your Compose Multiplatform applications./composeApp
It contains several subfolders:
-is for code that's common for all targets.commonMain
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
For example, if you want to use Apple's CoreCrypto for the iOS part of your Kotlin app,would be the right folder for such calls.iosMain
*is for the code that will be shared between all targets in the project./shared
The most important subfolder isWhatever you put in. If preferred, you can add code to the platform-specific folders here too.```commonMain
shared
will be shared by all platforms, which includes server. There is logic or shared implementation you might want to put there so it can run on both clients and server.
composeApp
on the other hand will be used by whatever targets of your project use Compose Multiplatform (could be Android, iOS, Desktop, Web). You don't want to write this code in the shared
module because it makes no sense for the server project to depend on it.zsmb
07/25/2025, 6:57 AMNikhil Bansal
07/25/2025, 7:07 AM:shared
module as well, how is the .framework
file created with commonMain in both :composeApp
and :shared
? Is it a single .framework
file with code from both or separate ones?
For 2nd one, got it. That helps.zsmb
07/25/2025, 7:27 AMNikhil Bansal
07/25/2025, 7:28 AMOhiorenua Aigboje
07/28/2025, 7:14 AMzsmb
07/28/2025, 7:42 AMOhiorenua Aigboje
07/28/2025, 7:44 AM