Hi everyone :slightly_smiling_face: I am new to Ko...
# multiplatform
h
Hi everyone 🙂 I am new to Kotlin Multiplatform. Here’s my typical package structure for an Android app that I follow in every project I work. I usually use MVVM+Clean Architecture+Koin for DI in my Android apps. I have read a lot of articles regarding KMM. Most examples have one module for ios one for android one shared and so on. But if you follow MVVM+CLEAN you must have at least 4 modules. I just don’t know what should I do. Should I create all of that modules as packages inside shared module or should I create other modules myself? in app module I initialise dependency injection in presentation module I create UI and everything related to UI. data and domain modules are used for business logic, repositories,use cases,models and so on. Now with KMM I feel confused. Should I treat androidApp module as my presentation module and put the rest of the code in shared module? Thank you very much in advance.
j
kmp changes nothing here. I think you should understand what means clean architecture because your message looks like a copy of a medium post with a few rules. clean architecture doesn't mean 4 modules, or 1, or 30. You can apply clean using 1 module or 30, winning/losing some benefit that Gradle can provide based on how you structure it. For example, you have a domain module which is an android module, but clean says domain shouldn't depend on platform, so your domain module shouldn't be an android module because it has no benefit (polluted classpath, worse build time and so on).
👍 1
h
Thank you very much.
x
This is a layer-wise modularisation, and clean architecture doesn't prevent you from using feature-wise modularisation
h
I actually have problems with Clean architecture in general but for this project in particular I just needed to make a decision. Since this is my first KMM project I want to get everything right. I have read a lot of sample projects most of them follow similar approach when it comes to modularisation. In the end I decided to do the same. In the meantime I will study clean architecture more and will try improve my next KMM project.