Best Practices while Developing a App using Kotlin Multiplatform Mobile

 Checklist 

  • UI Technology
  • Architecture 
  • Team Setup 
  • Concurrency

UI Technology
  • Jetpack Compose for Android (not mature so choose fragments and views supported with rx )
  • SwiftUI for iOS (we choose 50y)

Architecture 
  • MVVM approach 
  • UI + VM + Data Source + Use Case (Business Logic)

Where should we split the code 

Coward Approach 
  • common Main :  Data Source 
  • created native : UI + VM + Use Case 
The lawful good 

  • common Main :  VM + User Case + Data Source 
  • created native : UI 
The chaotic good 
  • common Main :  UI + VM + Use Case  + Data Source 
  • created native : Nothing 
 Example : Moko widget to create UI 

Neutral Good or JetBrain 
  • common Main :  Use Case  + Data Source 
  • created native : UI + VM

Team Setup 
We have to develop 3 sections 
  • Android 
  • iOS 
  • Common 
Dog fooding Approach 
  • Android    : kotlin (Android engineer do this)
  • iOS  : swift 
  • Common : kotlin (Android engineer do this)

Concurrency 
  • Android : kotlin (Coroutines  both in Android and Common code )
  • iOS  : RxSwift ( coroutine not present) 
Concurrency in Kotlin/Native is very complicated 
Async wrapper to bridge the gap between these platforms. 


Before KMM was experimental and now it's alpha. So we can start working with it. 






Comments