Kotlin Multiplatform @ Memrise
We recently caught up with JetBrains to talk about how we’re using Kotlin Multiplatform to share core learning logic across our client apps. The following is an excerpt from the case study.
Our mobile app
Memrise’s mobile app was launched over 5 years ago. Developing natively for iOS and Android gave us the flexibility to balance our branding with individual platform UI paradigms. That strategy paid off: we’ve won several Best App and App of the Year awards.
But there’s another side to the story. At the heart of Memrise is a set of algorithms that optimize the learning process, and this logic was completely duplicated on each client. Whenever we had to debug inconsistent behavior between platforms, it was clear we’d essentially been writing the same code but in different programming languages.
Moving the shared logic to our backend systems wasn’t an option. That would present performance challenges and stop us from offering a full offline experience — an important feature of Memrise. Our learners expect to be able to use the app on planes and underground trains. Popular cross-platform frameworks like React Native and Flutter didn’t meet our needs either, because the code we wanted to share is platform-agnostic business logic. We briefly experimented with a Rust library, then quickly settled on Kotlin Multiplatform.
Adopting Kotlin Multiplatform
Our main principle for defining a multiplatform strategy was that we should be able to migrate logic incrementally. Kotlin itself was another factor. Given its ubiquity in the Android world and its similarity to Swift, we’ve been able to avoid a steep learning curve or a fragmented developer experience.
We shipped our first Kotlin Multiplatform code to production in an iOS release 2 years ago. We’re now sharing our core business logic between Android, iOS, and even our web frontend via Kotlin/JS.
Starting this project on iOS was a happy accident. It exposed us to the challenges of the Kotlin/Native memory model early on and highlighted some Cocoapods tooling we’d have to build (although Cocoapods now has official plugin support).
As early adopters, our challenges have centered around tooling and development workflows. The multiplatform library itself has been a big success. We’ve been able to maintain 100% test coverage during our migration, and we now have a single source of truth for some of our most important logic.