Exploring Compose Multiplatform for iOS & Android

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.

要查看或添加评论,请登录

Nathan Holland的更多文章

  • Recipe for a perfect Mentor

    Recipe for a perfect Mentor

    A couple of days ago, I saw a poll on Instagram shared by a friend and climbing coach. The question was: "Does it…

    2 条评论
  • Inside Insights on Inside Jokes at Work

    Inside Insights on Inside Jokes at Work

    The other day, I was catching up with an ex-colleague and reminiscing about our time working together. One of the…

  • An Experiment in AI: App Development

    An Experiment in AI: App Development

    Last year, as AI came to the forefront of conversations in tech, I maintained a healthy scepticism as to how useful it…

    5 条评论
  • Learning for Learnings sake

    Learning for Learnings sake

    Learning at Work My pathway into software development was unconventional. At college I studied Maths, Physics…

    1 条评论
  • The Invisible Process

    The Invisible Process

    Recently, I was in a conversation with a colleague regarding when to implement processes within a company versus when…

    1 条评论
  • Shaping Up

    Shaping Up

    A few months ago, scrolling through my LinkedIn feed, I noticed a listicle of "Must reads for Engineering Managers"…

    1 条评论
  • Mindsets on my Mind

    Mindsets on my Mind

    Recently whilst attending a leadership training session run by the brilliant Pinja Fernstr?m, I was introduced to the…

  • Working from home with kids

    Working from home with kids

    Three weeks ago when my company decided to go remote I was at something of a loss on how it would be possible. A few…

  • Following up on Team Feedback

    Following up on Team Feedback

    Disclaimer Prefacing this article I want to explain the motivation behind it. I am the head of development for an…

    1 条评论

社区洞察

其他会员也浏览了