Exploring Compose Multiplatform for iOS & Android
Earlier this year, I came across an article about Compose Multiplatform, an extension of Kotlin Multiplatform (KMM). I had always been somewhat averse to cross-platform mobile development, mainly because I believe each platform has its own unique feel, and the UI and flow should reflect that. KMM solves that by having native UIs sit on top of a shared business logic, But I was intrigued whether a declarative UI framework like Compose could achieve those platform-specific differences with a single codebase? It was time to find out.
Lat year I tasked an AI with building an android app An Experiment in AI: App Development, that UI already used compose so I thought it would be a good candidate to port over and rebuild with Compose Multiplatform. FrequenTask is a simple app that tracks recurring tasks, scheduling them based on user input.
A Different Development Experience
Designing the architecture, my aim was to target both Android and iOS with as little platform-specific code as much as possible while still delivering a good user experience on both platforms.
Compose Multiplatform, thankfully, is built with this kind of thinking in mind. However, it wasn’t without its challenges. A significant portion of the work was dedicated to finding libraries that were compatible across platforms, as the ecosystem is still evolving. One example of platform differences that became apparent quickly was navigation—Android has a system-level back button, while iOS does not, which required me to rethink how navigation works in the app.
This was solved by including a conditional "up" button in the iOS version's header bar which appears when needed to allow users to navigate back from detailed screens. On Android, of course, the system handles this. Outside of that, the user experience across both platforms should be broadly the same.
Setting Up and Working with Compose Multiplatform
One pleasant surprise was how relatively easy it was to get up and running with Compose Multiplatform. Setting up the project took a bit of tinkering, but the documentation and tools are very good. JetBrains even offers a project wizard, which helps to quickly scaffold the basic plumbing for a Compose Multiplatform project. From there, it was just a matter of adjusting the build configuration for iOS and setting up shared resources.
领英推荐
Using Compose really allowed me to focus more on the UX and the flow of the app rather than getting bogged down in building any of the boilerplate stuff.
A Quick and Satisfying Build
In total, this rebuild didn’t take long. Much of the logic and even the Compose functions could be ported over from the Android version of FrequenTask with minimal tweaks. The real time sink was researching libraries and learning the nuances of the new framework. In total, I spent about 12 hours on the project, including research time.
For an app as simple as FrequenTask, Compose Multiplatform felt like a natural fit. I could see the potential for using it in future projects where the UI isn’t too complex. While I’ve traditionally leaned towards native applications, this project showed me that cross-platform development is starting to live up to its promise.
The Future of Cross-Platform Development
Looking forward, I believe cross-platform development is becoming a viable alternative for a much broader range of applications. With Compose Multiplatform, we’re already seeing tools that can generate code good enough to rival native apps while maintaining platform-specific nuances. I’m excited about the direction this technology is heading and am eager to experiment more in this space.
If you're considering a cross-platform approach for your next mobile project, I would recommend giving Compose Multiplatform a shot. The tooling is solid, and if you’re looking to dive into cross platform development, this framework has a lot of potential.