Over the past few years, React Native has become a popular choice for the Android and iOS apps development. The cross-platform code sharing promise is undoubtedly the most tempting feature of this technology. Despite being a very popular choice React Native is not a holy grail and has its own limitations. There are companies which already decided to change their mobile tech stack radically and switch to platform-native development of their existing apps.
There is however a new solution available which aims to allow implementing scalable, multiplatform projects which promise to eliminate the React Native issues. Kotlin Multiplatform allows targeting not only iOS and Android but also backend, web frontend, and desktop platforms at the same time allowing to compile the shared codebase into platform-specific executable code without any bridge.
This article will compare and contrast the capabilities of the well-adopted and already mature React Native technology with the new experimental Kotlin language feature called Kotlin Multiplatform in order to find out what use cases each of them better suits for.
The big advantage of React Native is the big community and good adoption in the mobile community. There are plenty of external libraries and custom, open source components available around. All this makes it convenient choice for rapid prototyping and quick MVPs.
UI code shared between iOS and Android
Live reload of the app's UI
A great number of open source libraries
Reusable UI code
Short team size
Good for small mobile MVP projects
Bridged communication between JS code and native platform
Limited to iOS and Android platforms
Since Kotlin started to be officially supported by Google as a language for Android apps it is constantly growing. Kotlin is becoming very popular among developers because of its cleanness and development speed. It was even chosen as the second most loved programming language in the Stack Overflow Developer Survey in 2018. Although this new language itself is currently most popular among Android developers it can be used also on the backend and frontend sides. Moreover, it can be compiled and run natively on iOS, MacOS, Linux, Windows, WebAssembly, and even embedded systems like STM32.
Multiplatform development of business logic code
A great number of compilation targets - Android, JVM, native: iOS, Windows, Linux, embedded platforms and more
Modern language - safe, concise syntax, efficient multiplatform async framework and more
Compilation to native platform-specific executable artefacts
No bridges between shared code and native platforms
Best possible performance
Possibility share code on many platforms: Android, JVM, JS, native (iOS, x86, stm32 and more)
Suitable for top-crafted, scalable projects, not only for mobile apps
Still in the experimental state
A limited amount of available libraries
Usually requires a bigger team of devs working together
Less suitable for fast MVPs and prototypes
React Native tends to lose its domination in the mobile area which is probably caused by the latest release of Flutter - another multiplatform UI framework by Google. The future of both is still unknown, although it seems the hype for Flutter has already started.
Is there a place for Kotlin Multiplatform then?
It seems so. It turns out it could be a great technology to be integrated into the mobile apps along with Flutter. That’s because Flutter allows separating the UI layer from the business logic effectively and Kotlin Multiplatform provides an exceptionally good way of the business logic code sharing among multiple platforms.
There is also an experimental Google project under development - the Hummingbird. It aims to allow reuse of Flutter UI code not only on mobile platforms but also on the web frontend. And that’s the web frontend where Kotlin Multiplatform has the potential to be used as well. The Flutter for Web beta is speculated to be announced around Google I/O 2019.
Are we going to develop multiplatform apps for the mobile and web platforms at the same time? it seems there is going to be such an option available. Developing apps with Kotlin Multiplatform and Flutter would require the use of two languages - Kotlin and Dart, however, from the developer perspective both languages are friendly. Although there are already the basic Kotlin Multiplatform libraries available like SQLDelight database, Ktor REST API client or Kissme - secure key-value storage, the Kotlin Multiplatform adoption will highly depend on the development of the new ones.
Is it the end of React Native? Probably not. As a mature technology, it will still be great choice for iOS and Android apps - especially for rapid MVP development and fast prototyping. However, it seems it is going to be an interesting year and the new multiplatform development standard is just around the corner. Stay tuned and let’s see what this year comes with!