Post your project requirement
Discuss project details with our technical analysts
Select engagement model and timelines
And we start coding
© Briskstar Technologies 2024
You may think of Kotlin as a Java-like JVM language, but JVM is only one of its available targets. Kotlin can be compiled to JavaScript (and work with React) and to native platform code with Kotlin/Native. This means that Kotlin to iOS, macOS, Linux, Windows, or even WebAssembly is possible.
Kotlin/Native lets you create an executable, a static or dynamic library with C headers, or an Apple framework. It can also use existing C, Swift, or Objective-C libraries.
In this article, I will create an Android + iOS multiplatform project. But you don’t have to stop there, because you can do all of the following with Kotlin:
Android app: Kotlin/JVM
iOS app: Kotlin/Native
Backend: Kotlin/JVM & Ktor or Spring Boot
Frontend: Kotlin/JS & React
Desktop app: Kotlin/Native
Kotlin Multiplatform Mobile
Kotlin Multiplatform Mobile is a set of tools that make it easier to create Android + iOS multiplatform apps. Just keep in mind that KMM is in alpha development and still somewhat unstable. When you install the official KMM plugin and create a new project, it’ll automatically set up these modules:
androidMain
commonMain
commonTest
iosMain
Architecture
Following the MVP pattern, the app should have three layers of code:
Model, important for data repositories like APIs or databases
View, responsible for displaying data from Presenter and passing input to it Presenter, important for processing the data for View
You want to keep your Model and Presenter in the shared common module and implement Views in both Android and iOS, where you want them to stay as small as possible.
Libraries
You cannot use Android’s View Model or Live Data in the shared common module, because it’s written in Java.  You also cannot use RxJava nor Retrofit.  This module needs to contain pure Kotlin code, which complicates things a little bit.
But Kotlin Multiplatform has a solution for that in the form of two new keywords: expect and actual, which can easily be understood as declaration and implementation.
Testing
By extracting your logic to the shared common module, you’re now able to write blazing-fast unit tests that can cover a lot of successful and unsuccessful use cases. Use mocked API responses and create scenarios that will cover both platforms at the same time!
In Summary
Kotlin Multiplatform holds a lot of promise, but it’s still in its early days.
Pros (+)
Native performance – no additional runtime in your app bundle
No legacy code – you can start integrating KMM anytime
No shared UI – pixel-perfect native views
It’s easy to just add iOS to your existing Android app
Cons (-)
Not many pure Kotlin libraries available in the shared common module
Still in alpha, not production-ready
Tags :
We don't see any reason to wait to contact us. If you have any, let's discuss them and try to solve them together. You can make us a quick call or simply leave a message in our chat. We assure an immediate and positive response.
Questions about our services or pricing? Call for support
Our support will help you from  24*7
Select BudgetBelow $5K$5K - $30K$30K - $80K$80K - $200K$200K - $500K$500K and aboveNot decided
We warmly welcome you to request a free quote for your Briskstar Technologies project. Get in touch with us today and our representative will get back to you within 24 hours. We would happy to hear from you.
Upload File*