DEV Community

JE Ramos
JE Ramos

Posted on Edited on

Building a game using Kotlin Multiplatform

VibeBorn is a cozy, offline-first blind-box simulator. You wander a little toy town, buy boxes with gems you earned by playing, and open them in 3D to see which figure you got. It runs on iPhone and Android, and it's meant to work fine on a train with no signal.

For most of its life it was an iPhone-only app. When we decided to bring it to Android, we hit the question every small team hits: do we write the whole game twice?

The answer we landed on isn't new. Netflix wrote about it in 2020, sharing the business logic of its studio apps between Android and iOS with Kotlin Multiplatform. In 2024 Google said that Google Docs does the same across Android, iOS and the web. Those apps aren't games, though, and a game pulls two ways at once. The unboxing has to feel right on each phone, while the rules have to match exactly on both, roll for roll.

So we split VibeBorn down the middle: native UI on each platform, and one shared Kotlin core underneath for odds, prices, rewards and time. Here's how that went, including the parts we got wrong.

New to VibeBorn? It's free on iPhone and Android. Open a box first, then come back for the Kotlin.

Android already runs on the shared core. The dashed link is the iOS move landing in an upcoming update.

Where we drew the line

VibeBorn started as a SwiftUI app, with the unboxing rendered in SceneKit. Everything that makes it a game lived in Swift as well: box odds, prices, gem rewards, daily limits, mission timers and the whole catalog.

We decided early that the player-facing side would stay native on both platforms. The unboxing is the moment the whole game builds toward, and we wanted each version to use its own platform's 3D renderer and haptics. On Android that meant porting the SceneKit scene to SceneView. The app also wears a custom toy-plastic look with no stock system dialogs, which we found easier to get right in SwiftUI and Jetpack Compose directly. Payments and leaderboards go through each platform's own services anyway.

Babbel's team wrote about learning this the hard way. Their first shared-code attempt drifted into sharing UI while the logic stayed duplicated, and they had to pull it back. We wanted to start where they ended up.

There's one exception. The stacking arcade mini-game is a small web bundle, and it runs unchanged in a WebView on both phones.

Left: the toy mall, native on each platform. Right: the stacking arcade, the one piece that runs as a shared web bundle.

Android first, written for both

We built the Android version in October 2026 as a native Kotlin app, aiming for full parity with iOS. The decision that mattered most was where the game rules would live. We put them in a handful of small Kotlin Multiplatform modules: one for the economy, one for time, one for networking, and one holding the shared types and interfaces the others agree on.

Android was the only target at first, but we wrote those modules as if iOS already existed. Shared code isn't allowed to import Android APIs, Room, Hilt or Compose. When the game needs something the phone provides, like storage or the device clock, it asks through an interface, and each app plugs in its own version. We also only ever add to those interfaces, so a new field on one side can't break the other.

That kind of discipline can feel like overkill when there's only one platform. It's also why moving the core to iOS now looks like a packaging job.

Time is the hardest part of offline

In November 2026 we made offline-first a hard rule: gameplay never waits on a server. Opening a box or claiming a daily reward should work just as well in airplane mode.

The tricky part turned out to be time. A game with daily rewards and streaks has to trust a clock, and on a phone with no connection the only clock around belongs to the player. We wanted one that stays fair to people who play honestly offline without paying out twice to anyone fiddling with their settings.

We're not going to describe exactly how ours works, for obvious reasons. The part worth sharing is where it lives. It sits in the shared core, written and tested once, so the iPhone and Android versions can never disagree about whether your reward is ready.

In the game: your parcels arrive on a timer, and that timer reads the same shared clock on iPhone and Android, with or without a signal.

Proving both phones roll the same box

For a while the rules existed twice, once in Swift and once in Kotlin. We needed proof that a box opened on Android gives exactly what it would on iOS, and reading the two side by side was never going to catch a subtle difference in how a random number turns into a figure.

So the iOS app became the source of truth and started grading Android's homework. A test on iOS exports the full catalog plus a large set of "golden" examples: fixed random draws and the exact result Swift produces for each one. The export is deterministic, so running it twice gives byte-identical files. Android pulls those files in, and its tests replay every example. If the two disagree on a single roll, the build fails.

What this means for players: VibeBorn puts the odds right on the store board, rare golden pulls included. Those numbers have to be true on both phones, and the golden examples are how we keep them that way.

Our backend later started reading the same exported catalog, which means three codebases now agree on what a box costs and what's inside it.

Kotlin on iOS, without Gradle

Before we let the game's economy anywhere near iOS, we tried the path with something lower-stakes: our in-house bug reporter, the tool behind "report a problem" and crash reports.

It's built the way we want the whole game to be. The engine that saves, sends and uploads reports is shared Kotlin, and each platform draws its own native UI on top. On iOS the Kotlin part ships as a prebuilt framework inside a Swift package. The app adds it like any other dependency and talks to it from Swift. Nobody on the iOS side needs Gradle, a JDK or a Kotlin toolchain installed, and Xcode builds the app the same way it always did.

That last part mattered a lot to us. Cash App made a similar call: they moved away from embedding Gradle in their iOS build, rolled shared Kotlin out gradually, and kept most of their code native. The bug reporter showed us that Kotlin could ship inside an App Store build and be called cleanly from Swift, without making day-to-day iOS work any harder.

What we got wrong

STRV split their write-up of a KMP app in production into what worked and what didn't, and we wish more of these posts did that. So here's our list.

Our first move to offline-first was too blunt. To be sure nothing could wait on the network, we switched off a server-side check entirely. About two weeks later we brought it back in a gentler form that still works offline.

We also shipped a freeze. An early version of the shared clock read from storage every time something asked it the time, and on Android something on the main thread asked constantly. Google Play started reporting app-not-responding errors. The clock now keeps what it needs in memory and saves in the background, so asking the time never touches the disk. It's the kind of bug that looks obvious afterwards.

The last one isn't a bug. Keeping two copies of the economy is a tax on every change: it starts in Swift, gets exported and synced, then gets matched in Kotlin. The golden examples make that safe. They don't make it quick, and that's the main reason we're moving.

What happens next

The game's rules move to iOS in an upcoming update, the same way the bug reporter did. The shared modules get iOS targets, the core ships as a framework inside a Swift package, and the iOS app plugs in its own storage and clock. Before the Swift economy is retired, the same golden examples that kept Android honest will check that the Kotlin core gives identical results on iPhone.

The UI stays put: SwiftUI and SceneKit on iOS, Compose and SceneView on Android. What changes is that a new series or a price tweak gets written once.

What we'd pass on

If you're a small team weighing this up, the thing we'd repeat is writing the second platform as if it were already shared, even before it is. Starting iOS with a low-stakes module was the other good call. It let us see how Kotlin behaved inside an Xcode project before anything important depended on it.

There's plenty we don't know yet. We haven't seen how the shared core changes the iOS app's size or startup time, or how it feels for a Swift developer to step into Kotlin when something breaks. We'll write that part once it ships. If you've already been through it, we'd love to hear how it went in the comments.

Come open a box

Everything above exists so that opening a little box feels good on whichever phone you have.

If you want to see the native unboxing for yourself, VibeBorn is free on both stores:

Or grab it from vibeborn.everytech.io, which sends you to the right store. Follow us here on dev.to for the follow-up once the shared core lands on iOS.

Further reading

Top comments (0)