How the Kotlin Multiplatform saves development time. Personal experience of creating a quest application for KotlinConf 2019
Tags: kotlin, mobile, multiplatform, development
Published: 2020-11-06 18:36:09

#
Hi there! [IceRock Development](https://icerockdev.com/) here.

We would like to share our experience. We have been developing applications on the Kotlin Multiplatform for 2 years now. In 2018, we started implementing projects and made several important discoveries from the get-go. Among other things, we found out that the use of multi-platform technology saves a lot of time and effort.

We were once again convinced of its effectiveness at KotlinConf 2019, which took place in Copenhagen. This is the largest event in the world for Kotlin programmers. They come together to conduct workshops, exchange experience and just have a good time with like-minded people.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jcmujy85ra6lwolodl1u.jpg)
*Yes, it is a bit crowded. Because the community of programmers comes from several dozen countries. Photo from the [official JetBrains website](https://kotlinconf.com/2019/photos/)*

JetBrains, the organizers of the conference and the creators of the Kotlin language, offered us a project. A new version of the language was presented at the conference. It allows users to write code, including for Apple smart watches. To demonstrate this functionality, we had to create an application for three platforms: iOS, Android and WatchOS.

##A quest in the name of Kotlin: what we managed to do for the conference

During the preparation for KotlinConf, we worked with JetBrains on the Kotlin Locator / Finder. This is a quest game where players had to run around Bella Center. Bella Center is the second largest conference center in Scandinavia that was rented out specifically for KotlinConf 2019 in Copenhagen! It brought together 1,700 developers from all over the world.

The bottom line is this: players download the application and with the help of tips start looking for “magic points” that are marked with iBeacon tags. At these points, players can find interesting details about Kotlin: the history of the language, new tools, etc. The points are not that easy to find, as they appear only if the player approaches them at a certain distance.

To complete the game, the players need to find 6 beacons in different places.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/aeebzki71mjiccl7ezex.png)
*This is the Kotlin Locator / Finder interface on iOS for smartphones*

JetBrains created a [multi-request server](https://github.com/Kotlin/kotlinconf-spinner/blob/find_proto/httpserver/src/hostMain/kotlin/server/PROTOCOL.md) application based on the [Kotlin Spinner](https://github.com/Kotlin/kotlinconf-spinner/tree/find_proto) Game. They called us and told us about the idea. The art lead started conjuring up the design while the technical director and a specialist took over the innards of the application.

We negotiated the protocol with the server, drew a map and created the application architecture. We started developing on the iOS platform for smartphones. The first item in the terms of reference was a smart watch. But a version of Kotlin that allows coding for watches was released later. Therefore, the application for the watch was made after the application for smartphones.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/85culwbry1a0kasjzmyn.png)
*This is what the Kotlin Locator / Finder interface of a smart watch app looks like*

We tested everything. At the very end, an Android programmer was called in and only implemented the UI for Android. And voila – the application was ready.

We would like to share our developments:

* [application code](https://github.com/JetBrains/KotlinFinder);
* [application version for Android](https://play.google.com/store/apps/details?id=org.jetbrains.kotlin.locator);
* [application version for iOS](https://apps.apple.com/us/app/kotlinconf-locator/id1487944666).

In the process, we got some useful experience:

1. It was the first time we used Kotlin / Native on WatchOS with compiler version 1.3.60. And everything worked out great!
2. Debug interaction from common Kotlin code with iBeacon tags. We worked with the [Reedyuk / blue-falcon library](https://github.com/Reedyuk/blue-falcon). The library was eventually [forked](https://github.com/icerockdev/blue-falcon/) and refined. Some of the changes were transferred to the author of the original: [search for devices](https://github.com/Reedyuk/blue-falcon/pull/22), [display of devices](https://github.com/Reedyuk/blue-falcon/pull/18). He accepted our feedback and expressed his gratitude.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/emstspycdfaaeu4otohh.png)
Summary: we can say that everything we had planned was successfully implemented. At the same time, we tested the new version of the Kotlin Multiplatform and were convinced that it really is possible to write an application on it for a smart watch.

The application itself was downloaded several hundred times in Play Market and App Store. For a local event, this is a very good indicator. 20 people reached the end of the quest. The winners were awarded prizes by JetBrains.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/79phzucpjemvs5akjfq1.jpg)
*Just look at these faces! Yes, the guys look a little embarrassed*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xfqrawz5vjz6dhu8puio.jpg)
*Understandably! Because the coolest Kotlin developers in the world were looking at them!*
##We saved time and costs for the team: what the Multiplatform technology gave us

Drum roll – only an iOS developer was working on the app full-time. The rest – the designer, the Android programmer and tester worked part-time. And we made a completely native application!

Native apps are more complex and therefore more expensive. For standard double-platform application development, we would have hired one developer for iOS and another for Android. Then we would have had to pay full time to two developers. That is, we would have done double the work and spent one and a half times more resources.

With Kotlin, development speed is boosted significantly. We used the moko-network and generated all the code for working as a server for two platforms according to the openapi specification. Also, all the logic code: the logic of the game itself, the work with data, local storage, etc., was written only once in Kotlin. There was no need to duplicate anything.

Most of the bugs were found during development and debugging of the iOS application. Therefore, we created practically bug-free applications for watches and Android.

The Kotlin Multiplatform code is very similar to Swift. The Kotlin Locator / Finder app on iOS and Android have the same business logic: one piece of code is responsible for behavior on both platforms. This gives the same level of detail and stability, and, accordingly, convenience for the user.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s5zn3r627d6gmfn3a1l4.jpg)
*IOS app*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ddopmpdfewizkflqexru.png)
*Android app*

When working on the Kotlin Multiplatform, we saved resources, which means that in the end, we were able to make the application cheaper for customers and market it much faster.
##What The Kotlin Multiplatform Can Offer Businesses
We made the application together with JetBrains as more of an image project. But development is also a business. We were in the role of our own clients, as we spent resources in the same manner and waited for results, as is usually done when ordering an application for commercial purposes. Therefore, we were convinced on personal experience of how effectively the Kotlin Multiplatform helps solve business problems. 

Brief summary:

**Fast market entry.** All the stages of development, verification and testing are almost 1.5 times faster than when creating native apps separately on iOS and Android. Although it all depends on the complexity of the UI, it is still possible to speed up development by an average of 20-50%.

**Cost saving.** With Multiplatform technology, there is no need to duplicate code, which means that there is no need to do any extra work. Therefore, there is no need to pay for the work of additional specialists. If the project is simple, one programmer can create applications for two platforms.

If the project is more complex, one specialist needs to write the general code and the business logic and a developer on another platform does not have to do any double work. All that needs to be done is connect the application to the shared library and add the UI.

**Completely native application.** The application is adapted for a specific platform and convenient for both developers and users.

**Compatibility with other programming languages.** If there is an application that the Kotlin Multiplatform has to be integrated into, there is no need to completely rewrite it. The language is similar to Swift and compatible with Java.

We at [IceRock Development](https://icerockdev.com/) now run most of our projects using this technology. We announced 2019 as the year of the Kotlin Multiplatform at the company.

We are trying to contribute to the development of the international Kotlin community. Let us show you a couple of useful things:

* [https://moko.icerock.dev](https://moko.icerock.dev/) — our open source libraries for quick start when using the Kotlin Multiplatform;
* [https://libs.kmp.icerock.dev](https://libs.kmp.icerock.dev/) — a site with libraries for the Kotlin Multiplatform;
* [https://kmp.icerock.dev](https://kmp.icerock.dev/) — a site with libraries and links to projects;
* [https://t.me/kotlinmpp](https://t.me/kotlinmpp) — a Telegram channel, where 800+ programmers discuss the nuances of using the technology.
If you have any questions, please email us at mpp@icerock.dev. Any feedback is welcome!