Develop both for Android and iOS
To develop an app in Android and iOS native platform we need to have
- separate developers for both the Android and iOS platform
- Separate business logic for both the platform
- Separate testing team for both the platform
Hence we need
To develop application for Android, iOS and Web we need
What is the solutions for the above problem:
Cross platform is the solution for the above problem and there are many cross platforms framework available like Xamarin, Ionic, React-native, Kotlin multi-platform and Flutter but here i will discuss about the Kotlin Multi-platform.
What is KMP:
Support for multiplatform programming is one of Kotlin’s key benefits. It reduces time spent writing and maintaining the same code for different platforms while retaining the flexibility and benefits of native programming.
With out KMP
Without KMP we have to write separate Network code, model classes, response parsing code and common presentation logic code for all the platforms for Native, JVM and JS hence we will require more resources, time and cost.
With KMP we have to write single Network code, model classes, response parsing code and common presentation logic code for all the platforms for Native, JVM and JS hence we will reduce the number of resources, time and cost.
- Business logic reusability
- Smooth interoperability
- Native UI
- High performance
- Improved flexibility and scalability
The common code is compiled to Bytecode which can be directly used by android and for native the common code is compiled to iOS executable code
Working process of KMP:
Kotlin konan compiler compile to bytecode which is used by Android or any app which use bytecode, and for JS the compiler compiles to .js hence it can run in browser or Node or React and for ioS Kotlin compiler uses a set of IOS resources and framework that is merged with the common code and generate iOS app
Communication between Common code and target module code:
What can be shared
Here we are sharing the Data layer which holds Repositories, Http clients for network call, Caches, Domain which holds Entities and interactors, Common Presentations which holds View models,presenters,controllers rest the Android and iOS can have their own presentation for UI
I will come up with a practical guide for the above topics soon...