Sharing Code Between Android and iOS: Ricardo’s Journey with Kotlin Multiplatform

03.04.2025

At Ricardo, we have two perfectly fine apps, one for Android and one for iOS. They look and feel quite similar. But more importantly, they should behave exactly the same. One of the challenges that we have, is that each topic team only has two mobile developers, one Android developer and one iOS developer. Features they implemented natively might have started off similar, but as time progresses they can look quite different in terms of business logic. On one platform a change can be introduced that is not added on the other platform for example. This can lead to more bugs and unexpected behaviour of our apps. Moreover, if two features should behave the same, why are they implemented twice, in the same way? To solve this problem, we started to use Kotlin Multiplatform. 

In this article, I will walk you through our experience – from early proof-of-concepts to full-fledged implementation – highlighting the challenges we faced, the solutions we found, and our vision for the future of KMP at Ricardo.

So What is Kotlin Multiplatform (KMP)?

KMP is a technology that allows developers to write code once for various platforms but it retains all the benefits of native programming. The code can be shared easily for iOS, Android, macOS, Windows, Linux and even Web! At Ricardo, though, our focus is exclusively on iOS and Android. 

Unlike fully cross-platform frameworks like Flutter or React Native, KMP focuses on sharing logic, allowing each platform to retain its native UI and feel. You can share as little or as much as you want, and you can add it immediately to your existing code base. Preventing a full rewrite of your apps, and preventing a full lock-in to the technology. Additionally to that, as it’s fully written in Kotlin, Android developers don’t need to learn a new language and for iOS engineers it’s easy to pick up since the language semantics are quite similar to Swift, which is used in iOS.

How Did We Implement It at Ricardo?

We made several proof of concepts to make sure KMP would really help us, and to address all the concerns of our mobile guild members. For Android developers, it wasn’t a significant change, but for our iOS engineers, adopting a completely new technology was a bigger adjustment. As it’s important that every developer is on the same page, we wanted to address all of the concerns regarding tooling, way of working or more in-depth concerns, for example regarding threading. 

Additionally, because both of our apps have grown apart, it was also needed to align our vision of the target architecture. Without this, it would have been almost impossible to integrate our shared code properly. 

Once all of the blockers were resolved, we could move on to an implementation phase. We had the initial goal of just migrating our network/data layer of the apps to KMP but since everything went so smoothly, we even started moving business logic already to KMP, way ahead of our initial plan! 

Some Technical Details in a Nutshell

For now, we only share code up to the view layer. From our shared code, we only expose “interactors” (an interactor is a part of clean architecture that handles the core business logic, connecting the pieces to process input and deliver the right output). All of the other components are marked as “internal” and can’t be accessed by the consumers of the shared code. Our interactors often expose some functions or a reactive flow of data, the consumers can listen to this flow of data and update the UI of our apps when the data changes.

 
All of our exposed functionality return a type of Result, this holds either the success value of the called function or the failure in the form of domain error. This allows us to handle our errors gracefully, and more meaningfully. Our shared code is integrated in our Android project as a Maven dependency and in iOS via CocoaPods.

Where Do We Stand Now and Where Do We Want to Go

At the moment, several key features of our app are leveraging KMP. These include functionalities on the order detail screens, our notification hub, and the product screen, though the latter is not yet fully integrated into iOS. Additionally, a significant portion of our network calls is now shared, streamlining communication across both platforms. In 2024 alone, we had merged over 120 pull requests, with contributions coming from both Android and iOS engineers, showing how actively the entire team is involved. 

All of our new features will be using KMP, and where it makes sense, old features will be rewritten using KMP. Rewriting luckily means often just moving code from our Android code base, to our shared code base. 

This year, we’re aiming to make the developer experience with KMP even better. It’s already pretty great, but we think it can get even smoother by integrating the shared code directly into the Android and iOS projects. This way, we won’t need to jump between repositories, making it easier and faster to build new features. 

KMP has already become super popular in mobile development, and with Google officially backing it, we’re even more confident it’s here to stay. On top of that, Google has started making some of their Android libraries work with KMP, which is a huge win for everyone using it! 

Special Thanks!

I would like to give a special mention to our mobile guild members, who have been very supportive in making this transition to KMP happen. Thanks Nicolas, Jessica, Jerome, Ingrid, Yannick, Giovanni, Sergei and Zsolt, you are all awesome!

Author

Ronald van Duren
Senior Mobile Engineer

General Marketplaces

Marta Andreoni

Head of Design for Automotive

Introduce yourself and your role at SMG

I’m Marta Andreoni, Head of Design at SMG Automotive. I lead the design and UX writing team shaping AutoScout24 user experience. 

In my role, I wear many hats. My main focus is ensuring we stay true to our vision “simplifying people’s lives and connecting humans through innovative digital platforms” and our brand promise, “make it happen”. I challenge my team to think user-first, push for innovation, ease of use for our customers and make forward-thinking decisions, even within business and technological constraints.

 A big part of my role is supporting each designer’s growth, motivation, and career development. Through one-on-one coaching, mentoring, group work, and projects, I help my colleagues set and achieve their goals while fostering new learning opportunities.

What helps you feel empowered and confident in your role?

If I had to mention one thing I would say “being proactive” has been key to feeling more empowered. I enjoy solving problems, so when issues or opportunities arise, be it in the product, market or the team, I get curious and I proactively investigate the reasons and try to bring inputs to be discussed with others, this makes me feel I can be part of the process or solution and my point of view is going to be taken seriously. My optimism also plays a role, giving me confidence that even the most complex challenges can be solved. 

Besides, having trust from other managers and colleagues makes me feel in a safe environment where I can take ownership on topics I’m passionate about. 

What’s one thing SMG does well in fostering an inclusive workplace? What more can be done to amplify and support different perspectives in the workplace?

In my experience, we strive for balancing top-down and bottom-up inputs, ensuring employees can influence product directions, processes, and culture. People are approachable, and our strong feedback culture helps voices be heard. Across SMG, initiatives like regular People & Culture Surveys, topic guilds, and events in our locations across the world foster open exchange and mutual learning.

That said, I’ve noticed that quieter voices sometimes get less space, or interacting with top management can feel intimidating, especially when giving critical feedback. To make participation more inclusive, we could apply more facilitation and group work techniques like structured turn-taking, written input, and smaller group discussions – ensuring everyone, regardless of confidence level, seniority or personality, feels comfortable contributing. 

Design is often about seeing the world differently. How do unique perspectives contribute to more innovative, inclusive, or impactful design?

Design is about understanding diverse user personas and perspectives to create solutions that truly meet their needs or create new opportunities. I believe in the power of collaboration to shape user experiences – bringing together different disciplines, backgrounds, and lived experiences helps challenge assumptions, uncover blind spots, and drive more inclusive, innovative, and impactful solutions.

Looking back on your career, what’s one lesson or piece of advice you wish you had known earlier as a leader in design?

There are three things no one really prepares you for as a design leader: dealing with constant change, facing failure and handling emotions at work. These topics aren’t talked about much until you face them. I was lucky to learn from others’ experiences, but much of it came through my own.

One thing I wish I had understood earlier is the power of emotional intelligence, my job is no longer about the content and the design, it is about people. Self-awareness, not just of your own emotions, but also how others feel and react, can be the difference between conflict and harmony, frustration and clarity. The more I grow as a leader and designer, the more I realise that design isn’t just about doing the design job, delivering solutions on the market: it’s about navigating people, their emotions, and making change more acceptable and transforming issues into opportunities, both within the organisation and through great products.

 

Photos de la Direction avec et sans couleur de fond en fichier ZIP

Logo à télécharger dans toutes les versions