Kotlin Multiplatform / Faster Development at a Lower Cost. Migration to Kotlin Multiplatform Mobile

Faster Development at a Lower Cost. Migration to Kotlin Multiplatform Mobile

Kotlin Multiplatform Mobile is a multiplatform tool that allows you to write universal code for iOS and Android, while saving up to a third of your budget and speeding up the development by 25%. But what if you already have a project, and you want to migrate to KMM? In this article we talk about what type of multiplatform migration costs $1300, $6000 and $40000.

When should you integrate KMM?

You can migrate to Kotlin Multiplatform Mobile both at the start of your development and at the implementation or launch stage. In order for the migration to make sense, one or more of the following conditions should apply:

  1. You already have an app for multiple platforms, Android and iOS, or you have just started developing such an app.
  2. Your app with Android and iOS versions has a complex business logic but a simple UI. For instance, it uses offline synchronization.
  3. You already have an Android app in Kotlin, but you urgently need an iOS version which utilizes your previous work.

60% of developers use or have tried Kotlin Multiplatform in production according to this recently published survey by JetBrains.

What are the benefits of KMM integration?

It can potentially save you up to a third of your budget. This is mainly because you develop a common code base for two platforms, Android and iOS, which can be done by a single developer.

You can speed up your development by 25% and implement new features on both platforms faster and easier in the future.

The projects will behave identically on these platforms without any discrepancies in minute details or complex cases.

iOS and Android developers will share the context, which will allow them to understand each other’s code in any part of the business logic and to promptly improve and fix it.

These might be the reasons why over 75% of those who have played around with Kotlin Multiplatform are considering to use it for their production.

How does KMM migration occur?

The process of migrating to KMM depends on your current situation with the project. There are three basic scenarios. Let’s use our case studies as examples.

Scenario 1. You have an app on both platforms and you need expert advice on developing common business logic.

This is the type of migration we did for Profi.

Profi is an app for searching for tradespeople and professionals in different fields. The app runs on iOS and Android. The customer asked us to help with migrating its business logic from the Android app to multiplatform.

The process we went through:

  1. We signed an NDA.
  2. We analyzed the project.
  3. After that we created an individual plan for KMM integration.
  4. The customer used our plan to move business logic to common code.

How long it took and how much it cost. In general, an integration using this scenario can take anywhere from two weeks to half a year depending on the project, and the cost starts at ~$6600. But in this case the customer did most of the work himself, and we only helped them plan their migration. Our part took us just a few days: in this time we analyzed what the customer had already done to create common code and prepared the plan for business logic migration.

The plan for this project included the following steps:

  1. Set up Kotlin Multiplatform support in the Gradle module.
  2. Move platform-independent classes to commonMain.
  3. Replace JVM/Android libraries with their multiplatform counterparts.
  4. Move JVM-dependent code to be changed to commonMain.
  5. Move Android-dependent code to be changed to commonMain.
  6. Make public interfaces of the common logic components easy-to-use on both platforms.

Afterwards the Profi team was able to use our review in their work.

Scenario 2. Your team has had some success in trying KMM, and you only need expert advice.

This was how we worked with Footballco, an international service for watching football, which also runs on both iOS and Android.

We joined the project at the launch stage. The customer’s team first created common business logic on their own and plugged it into their Android and iOS apps, and afterwards they reached out to us for advice.

The process we went through:

  1. We signed an NDA.
  2. We analyzed the project.
  3. We have provided our recommendations and learning materials.
  4. The customer implemented some of the recommendations and contacted us for an explanation about another part.
  5. We went over the unclear parts during a conference call.

How long it took and how much it cost. Analyzing and planning usually takes two to five days, and the cost starts at $1300. The audit for this project took us three days and came out at exactly $1300.

Here are some of our recommendations for this project:

  1. Streamline the Gradle configuration using the official plugin and open-source libraries.
  2. Enable project hierarchy to use IDEA hints and auto-completion features in iosMain.
  3. Enable Kotlin/Native cache, since this significantly improves debug build time.
  4. Avoid transitive module export and enable it explicitly for the required modules and libraries to improve build time.
  5. Move away from manually wrapping coroutines in favor of auto-generated ones to get equivalent asynchronous methods based on closures on the Swift side.
  6. Set up object freezing right in the init to avoid potential errors with multi-threaded operation.
  7. Fix the bug with the iOS app launching: one of the Gradle plugins was working incorrectly. It turned out that the Gradle task podspec was configured for a static framework, but the last build of the framework was dynamic. To fix this, we suggested making podspec generate a dummy dynamic framework, so that everything compiles nicely.

Scenario 3. You have to urgently release an iOS version for the existing Android app without interrupting the development to merge business logic of both apps afterwards.

This is what we did for GetMega, an app for multiplayer online gaming and chatting. We based the common code on the Android version, which was already written in Kotlin, and designed it for iOS integration. This allowed the customer to get two apps with common logic without interrupting their work on the features of the Android app.

The process we went through:

  1. We signed an NDA.
  2. We analyzed the project.
  3. After that we created an individual plan for KMM integration.
  4. Then we wrote code for the second platform with the integration in mind, so that the customer could integrate it with the Android version on their own.

How long it took and how much it cost. This is the most expensive and complex service, the cost can start at ~$13000. Analyzing and planning usually takes two to five days. Developing an app with a common code can take one to six months, and the integration with the original platform might require anywhere from two weeks to several months. For this project the analysis took us three days and the development was finished in three months. And the customer stayed within the budget of ~$40000.

Which parts do developers move into the common code according to statistics? Between the platforms, 76% of developers share data models, 66% share networking, and 65% share data serialization.

We’d be happy to consult teams and businesses on mobile app development with Kotlin Multiplatform Mobile or help with development. You can contact us here.

And here’s a final piece of statistics for you: 45% of developers have participated in more than one Kotlin Multiplatform project. Tell us in the comment section whether you are one of them ;)