Over the past few years, React Native has become a popular choice for Android and iOS app 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 limitations. There are companies which already decided to change their mobile tech stack radically and switch to platform-native development for their existing apps.
There is however a new solution available which aims to allow implementing scalable, multiplatform projects and promises to eliminate React Native's issues. Kotlin Multiplatform allows targeting not only iOS and Android, but also backend, web frontend, and desktop platforms at the same time, allowing you to compile the shared codebase into platform-specific executable code without any bridges.
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 is better suited for.
The big advantage of React Native is the big community and wide adoption. There are plenty of external libraries and custom, open source components available. 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
Does not require a big dev team
Good for small mobile MVP projects
Bridged communication between JS and native platforms
Limited to iOS and Android
Since Kotlin as a language for Android app development started being officially supported by Google, it has been 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 the most popular among Android developers, it can also be used 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 artifacts
No bridges between shared code and native platforms
Best possible performance
Possibility to share code between many platforms: Android, JVM, JS, native (iOS, x86, STM32, and more)
Suitable for well-crafted, scalable projects, not just for mobile apps
Still in an experimental state
Limited number of available libraries
Usually requires a bigger team of devs working together
Less suitable for fast MVPs and prototypes
React Native is losing its dominance 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 that 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 to share business logic code between multiple platforms.
There is also an experimental Google project under development - Hummingbird. It aims to allow the 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 be able 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 basic Kotlin Multiplatform libraries available like the SQLDelight database, the Ktor REST API client or Kissme, a secure key-value storage solution, the adoption rate of Kotlin Multiplatform will highly depend on the development of new ones.
Is this 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 that it is going to be an interesting year and a new multiplatform development standard is just around the corner. Stay tuned and let’s see what this year brings!