Hi All, Looking for an information for new project. - what is the percent of KMM code can we share in a iOS/Android project with clean architecture. Is anyone willing to share in their experience how much percent reuse you achieved?
t
Trey
09/22/2022, 4:07 PM
Hard to say. It will depend on how much business logic the application will contain. The UI will need to be implemented for each platform, but you can share view models. I recommend looking at some of the samples like KaMPKit or PeopleInSpace to see how much is shared. https://kotlinlang.org/docs/multiplatform-mobile-samples.html
a
Arun Joseph
09/22/2022, 4:11 PM
Thanks, I looked at some sample projects and found 60%kmm, 40%android, 40%iOS, does it match real projects?
t
Trey
09/22/2022, 4:12 PM
I haven't finished our project yet, so I don't know our percentages. I think ours will be better than 60% though. Probably closer to 70%.
m
Matti MK
09/22/2022, 5:01 PM
For us it’s between 65-70% Kotlin, shared VMs and clean architecture.
s
Sam
09/24/2022, 9:08 PM
Same, started off with separate platform specific viewmodels for flexibility but quickly realised there was no point. So now pretty much everything except UI is common Kotlin code.
Our approach is to use a state driven approach where viewmodels each have a sealed class representing view state which we convert to a swift enum using https://github.com/icerockdev/moko-kswift
It's working well so far
a
Arun Joseph
09/25/2022, 5:41 PM
Thanks all, We will also have to explore shared VMs.