From Android to Multiplatform: Migrating real 100% Jetpack Compose App to fully Multiplatform App. Intro

Marko Novakovic
3 min readApr 25, 2023

--

A step-by-step guide to migrating to a Multiplatform Compose Multiplatform app.

Photo by amirali mirhashemian on Unsplash

App this series will be about: https://play.google.com/store/apps/details?id=tech.mapps.winthedaywinthelife.android

About the app

App is habit tracker like. User is able to define steps in the process and track consistency. User either wins or loses. The goal is to keep win streak going.

Some of the things app is using:

  1. Jetpack Compose for UI
  2. Hilt for Dependency Injection
  3. Jetpack Navigation for navigation
  4. ViewModel
  5. RevenueCat for monetization
  6. SQLDelight database
  7. Custom design system
  8. Ktor for networking
  9. Arrow for easier and more enjoyable functional programming

What I’ll cover in this series

I will take bottom-up approach. Migrating:

  1. Resources
  2. Theme
  3. Custom components
  4. Specific tricky UI examples
  5. Navigation
  6. Dependency Injection
  7. RevenueCat

Background Story

I had and idea for the app: system that I used to become successful Android Developer. I wanted to automate it and possibly help others. It’s simple and easy. Being Android Developer it was easy to decide how I’ll do it… make an Android app. I was playing around with Kotlin Multiplatform-Mobile for some time but I never used in read project so this was my chance. The original idea was: share logic and have native UIs -> the goal of Kotlin Multiplatform-Mobile, basically.

Going that route was challenging for me. Building Android Compose app was easy for me since I’ve been using Jetpack Compose since it’s pre alpha state and all the way forward. But I had zero experience building iOS apps. I didn’t know anything Swift nor SwiftUI. Zero. Challenge was to learn iOS development with Swift and SwiftUI. It seemed somewhat easy since Swift is similar to Kotlin and SwiftUI is declarative UI framework same as Jetpack Compose. But with this being my side project and I had little time to spare that became more and more unreachable.

At that point I started looking for other solutions. Flutter was out of the question, I don’t like it. I’ve been using Flutter since first developer preview back in 2017 but I never successfully made myself like it and now I’m doing it like this and this… when I need to, but I avoid it as much as possible.

Compose Multiplatform was something I tried couple of time and Desktop support was working fine, iOS not so much. First couple of times I dropped it without even making the app run on iOS but I was following it’s progress closely. It was still in experimental state and documentation was pretty much non-existent so it was a wild card but I decided to try with it. Even if I fail eventually it will hit alpha, beta, stable and I’ll be able to finish the app at that point. When I had iOS “Hello World” app up and running I wrote blog post about it to mitigate bad documentation.

So, I took on the challenge and started the migration process. It was hard, and I faced some weird issues along the way, but eventually, I got onto stable footing and the process began to smooth out. With each issue that I resolved I gained more confidence and the migration process started to become easier.

Despite the challenges that I faced, I was determined to make the Compose Multiplatform migration work. And in the end, all the effort was worth it because I was able to build the multiplatform app I had envisioned. With Compose Multiplatform, I was able to reuse 99% of the code which ultimately led to a more efficient and scalable app.

Stay tuned for the next post in this series, where I will start with a step-by-step guide to migrating your Jetpack Compose app to a fully multiplatform app using Compose Multiplatform.

--

--