Mobile Apps

Adding Kotlin Multiplatform to an Existing Android App

If you have a mature Kotlin Android app and an iOS app that keeps falling behind, Kotlin Multiplatform lets you share the logic without a rewrite. Here is what moves, which dependencies need replacing and the gradual path we follow.

Tablet on a wooden table showing an app dashboard with charts, beside a phone and a white coffee cup

Many companies have a mature Android app written in Kotlin and an iOS app that is newer, thinner or missing altogether. Every rule change, from pricing to validation to sync, has to be built twice, and the two apps quietly disagree. Kotlin Multiplatform offers a way out that does not involve throwing away the Android app: move the shared logic into a module both apps use, one piece at a time.

This is one of the most common starting points in our Kotlin Multiplatform development work. We have written before about how KMP compares with Flutter and about one shared core serving several apps. This article is about the first step: introducing KMP into an Android codebase that already exists and must keep shipping.

What Moves and What Stays

Kotlin Multiplatform has been stable since late 2023, and the shared code is ordinary Kotlin compiled for each platform: JVM bytecode on Android, native code with an Objective-C and Swift interface on iOS. The Android app keeps its Jetpack Compose or XML user interface. What moves into the shared module is the code that should behave the same everywhere:

  • Domain models and business rules: pricing, eligibility, validation, formatting of amounts and dates.
  • Networking and API models: the client that talks to your back end, with its error handling and retries.
  • Local storage and sync: the offline cache, the queue of pending changes and the logic that resolves conflicts.
  • Analytics event definitions, so both apps send the same events with the same properties.
  • Optionally, view models, since AndroidX ViewModel now supports multiplatform. Sharing them moves more logic out of each UI, at the cost of a stronger coupling to Kotlin patterns on iOS.

The user interface can be shared too, with Compose Multiplatform, which is now stable on iOS. For an existing app, though, we usually start with logic only and keep SwiftUI on iPhone; it is the lower-risk step, and UI sharing can be reconsidered later.

Audit the Dependencies First

Code can only move into the shared module if everything it uses is multiplatform. A typical Android app depends on several Android or JVM-only libraries, and the audit tells you how much work each feature will take:

  • Retrofit and OkHttp become Ktor client calls. The API surface changes, but the models usually carry over.
  • Gson or Moshi become kotlinx.serialization. Custom adapters need rewriting as serializers.
  • Room now has multiplatform support, so an existing Room database can often move with fewer changes than switching to SQLDelight, which remains a good choice for new schemas. Either way, existing user data must migrate cleanly on upgrade.
  • Hilt or Dagger are Android-only. Shared code typically uses constructor injection with Koin, or plain factories, while the Android app keeps Hilt and wires the shared classes into it.
  • java.time becomes kotlinx-datetime, and RxJava becomes coroutines and Flow. If the app still relies heavily on RxJava, that conversion is often the biggest single task.
  • DataStore supports multiplatform for simple settings.

Where a platform feature has no common library, Kotlin's expect and actual declarations, or a plain interface implemented on each side, let shared code call platform code such as secure storage or device information.

A Gradual Path Inside the Existing Project

  1. Add a shared module to the existing Gradle build, with Android and iOS targets. The Android app depends on it like any other module, so nothing changes for users.
  2. Move one self-contained piece first, such as validation rules or the API models, with its unit tests moved into commonTest using kotlin.test. The Android app now runs on the shared code, which proves it in production before iOS uses it.
  3. Replace JVM-only dependencies feature by feature, following the audit, keeping each change small enough to release.
  4. Publish the module to iOS as an XCFramework, consumed through Swift Package Manager, CocoaPods or a direct Xcode build phase, and call it from one SwiftUI screen.
  5. Widen the shared surface one feature at a time, removing the duplicated Swift code as each shared version proves itself.

Throughout, the Android app should be releasable at every commit. If a step forces a long-lived branch, it is too big.

Making the Shared Code Pleasant to Use From Swift

The iOS team's experience decides whether KMP succeeds. By default, Kotlin exposes an Objective-C style interface to Swift, which loses some information: sealed classes become plain class hierarchies, Flow is not directly usable as a Swift async sequence, and generics are limited. Suspend functions can be called with Swift's async and await, but cancellation needs care.

  • Design a Swift-friendly API layer in the shared module: simple types, clear names, no leaking of Kotlin-specific constructs into what iOS calls.
  • Use interop tools such as SKIE, which turns sealed classes into Swift enums and flows into async sequences, or KMP-NativeCoroutines. Kotlin's own direct Swift export is in development and will improve this further.
  • Involve the iOS developers from the start. They should review the shared API, be able to read Kotlin, and be able to build the module on their own machines.

The UI itself stays native on each side; our comparison of SwiftUI and Jetpack Compose covers how those two toolkits differ.

Build, CI and Team Practicalities

  • iOS builds need macOS. The shared module's iOS targets compile only on a Mac, so the CI pipeline needs macOS runners, and build times grow. Caching Gradle and Kotlin/Native output helps.
  • Version the shared module so the iOS app can pin a known-good build while Android moves ahead, or keep everything in one repository so both apps always build against the same commit. Both work; choose deliberately.
  • Agree ownership. Shared code needs reviewers from both platforms. Otherwise it drifts towards Android habits that are awkward on iOS.
  • Watch the app size and startup on iOS, since the Kotlin runtime adds to the binary. In practice this is modest for logic-only sharing, but it should be measured.

The work spans both platforms, so we staff it from our Android and iOS app development teams together, and the shared networking layer is a natural point to tidy up the back-end contract through our API development and integration work.

Is It Worth It for Your App?

KMP pays off when there is real logic to share and both platforms will be maintained for years. It is less compelling when the app is mostly screens over a simple API, or when there is no iOS app planned. If you have a Kotlin Android app and an iOS app that keeps falling behind, tell us how the two codebases are structured today and we will suggest which piece to share first.

Frequently Asked Questions

Do we have to rewrite our Android app to use Kotlin Multiplatform?

No. Kotlin Multiplatform is added as a module inside the existing Android project. Code moves into it piece by piece, and the Android app keeps working and shipping throughout. The Android user interface does not need to change at all, and most existing Kotlin code moves across once its JVM-only dependencies are replaced.

Will our iOS developers have to write Kotlin?

They will need to read it and review changes to the shared module, and ideally contribute small changes. Day to day, they keep writing Swift and SwiftUI, calling the shared module like any other framework. Most iOS developers find modern Kotlin familiar because it is close to Swift in style.

Can we share the user interface as well as the logic?

Yes, with Compose Multiplatform, which is stable on iOS. If your Android app uses Jetpack Compose, many screens can be shared. We usually begin with logic only for an existing app, because it carries less risk and keeps the iOS app fully native, then consider sharing screens where they really are identical.

How long before the iOS app sees any benefit?

The first shared piece, such as API models or validation rules, can be used by iOS within the first few iterations. The benefit grows as more logic moves across and duplicated Swift code is deleted. Starting with the rules that change most often gives the quickest payback, since every later change is then made once.

How We Can Help

Services Related to This Article

The work we do with the technologies discussed above — with pricing, process and real examples on each page.

  • Kotlin Multiplatform Development

    Share business logic across Android and iOS with Kotlin Multiplatform — native Compose and SwiftUI interfaces on one tested core.

  • Android App Development

    Native Android apps built in Kotlin with Jetpack Compose — Material 3 design, background work, offline storage and Google Play release management.

  • iPhone & iOS App Development

    Native iOS apps in Swift and SwiftUI for iPhone and iPad — Human Interface Guidelines design, offline data, App Store submission and review support.

  • API Development & Integration

    Custom REST and GraphQL API development plus integrations with CRMs, ERPs, payment gateways, shipping carriers and marketing platforms.

In Practice

Case Studies on This Topic

Projects where we put these ideas to work, each with a live demo.

  • Witley Bay Bingo Hall roof damage — Northshore Insurance
    • Kotlin Multiplatform
    • Jetpack Compose
    • SwiftUI

    Cross-Platform App Development

    Field Adjuster Apps on a Shared Core

    Android and iOS adjuster apps sharing one Kotlin Multiplatform core for assessment rules, sync and offline data.

  • Returns Warehouse Forklift moving boxes — Meridian 3PL
    • Kotlin
    • Jetpack Compose
    • Room

    Android App Development

    Warehouse Pick & Pack Android App

    A native Kotlin app for rugged scanners that keeps working when the warehouse Wi-Fi does not.

  • Room Interior — Harbour Hotels
    • Swift
    • SwiftUI
    • Apple Wallet

    iOS App Development

    Hotel Group Guest App

    A SwiftUI app with Apple Wallet room keys, Live Activities and in-stay service requests.

Keep Reading

  • Person typing on a laptop at an outdoor wooden table, with a smartphone, notebook and pen beside it

    Native Device Features in an Ionic App: Camera, Location, Push and Files

    Capacitor gives an Ionic app access to the camera, location, push notifications and the file system, but each comes with permissions, platform differences and store rules. Here is how we make these four features reliable on real devices.

  • Illustration of the same website shown on a desktop monitor, laptop and smartphone, with code and app icons around them

    Turning an Existing Website Into a PWA: What Changes and What It Takes

    Making an existing website installable takes a manifest and a service worker, but doing it without stale pages, confused updates or cached personal data takes more care. Here is what changes on the site and how we plan a safe retrofit.

  • Marketing website home page on a desktop monitor, with a keyboard, mouse, green mug and plants on a light wooden desk

    Astro for Marketing Websites: Fast Pages Your Team Can Still Edit

    Astro makes marketing pages fast by default, but a fast site only helps if the marketing team can change it. Here is how we pair Astro with a CMS, a block library editors can use, previews, forms and publishing that works without a developer.

Let’s Connect

Let’s Build Something Amazing Together

Share your project details and our experts will get back to you within one business day with the best solution — free consultation, no obligation.