


So, Android already has a Virtual Machine(VM) that is easily capable of running it.īut what about iOS, how can it run Kotlin? Can we do it without the Virtual Machine(VM)? Have you ever wondered how it works?įor iOS, Kotlin code must be converted to the source code(native code executable on iOS) that goes inside the framework. For Android, it gets converted to the Java bytecode that can be executed in the JVM. How does it work?įirst, we write the shared code in Kotlin. When we consider the Kotlin Multiplatform just for the two platforms which are Android and iOS, we write the business logic code once which runs on both the platforms. Native UI helps in providing the best user experience to the customers.

So, the appearance, behavior, and most importantly, the performance, all remain native.

When I say the Kotlin Multiplatform feature is very promising, there is a strong reason behind it, Kotlin Multiplatform let us reuse the business logic and does not impose any restrictions on how we build our App's UI. I love investing my time in learning these hard things the hard way and then sharing them with all of you. When we know how it works, we can get the most out of it. In this blog, we will learn how the Kotlin Multiplatform works. The Kotlin Multiplatform feature is very promising. Some other great resources in video format for learning how to build libs here and use cases hereĪlso, here's some other KMP projects and frameworks to use too.I am Amit Shekhar, a mentor helping developers in getting high-paying tech jobs.īefore we start, I would like to mention that, I have released a video playlist to help you crack the Android Interview: Check out Android Interview Questions and Answers. This said, and apologies for the long text so far, some of the resources I used to learn on how to integrate the common logic between my Android and iOS applications are: You can of course learn it all at once, although I would say that is a different question altogether. I would say that you need some experience with either (or both) to have a smoother KMP experience. Nowadays, the standard way of developing for Android is using Kotlin, which makes the learning curve a bit smaller and Swift for iOS. This said, "learning Kotlin Multiplatform" should come as "learning how to share the common code" between platforms and not as a whole mobile dev endeavour. Kotlin Multiplatform is a (imo!) great way to approach mobile applications development if the requirements match the use case it solves - from the documentation here "(.) brings the invaluable benefit of reuse for code and expertise, saving the effort for tasks more challenging than implementing everything twice or multiple times." I have personally used it to share logic between my mobile Android and iOS codebases whilst keeping the UI native (think of view models, networking layer, custom loggers, etc).
