← All posts software engineering

How to Move Fast: Reusable Cross-Platform Code in Kotlin

G
Gary Vincent
2026-11-093 min read
How to Move Fast: Reusable Cross-Platform Code in Kotlin

Shipping several apps alone only works if I don't solve the same problem several times. This post is about the one habit that matters most for that: build the small reusable thing once, use it everywhere, and be honest about what that costs.

I'll use a real example from my own portfolio.

The example: a house icon library

Each of my apps needed icons, and early on each one had its own mix of emoji and one-off drawings. They never looked related, and swapping one meant hunting through five codebases.

So I built a single icon pack. About 190 icons, drawn once as SVG in one source file, with one consistent color palette. A small Python script turns that source into Kotlin code, and every app uses the same generated file.

Using an icon in any app is one line:

Image(VinTekGlyphs.someIcon, contentDescription = null, Modifier.size(24.dp))

The same icon looks identical in all of my apps, on both platforms. When I add or fix an icon, I change the source once and regenerate.

A second example: one file that controls all my apps

Every app has a "More from VinTEK" strip that promotes my other apps. I did not hardcode that in each app. All of them read one small JSON file from my website.

When an app goes live, flipping it from "coming soon" to "live" is one edit to that file and a site deploy. No app update, no store review. Installed apps pick the change up within minutes. The iOS and Android versions of the file are generated separately so neither store's links ever appear in the other platform's app. That is important because Apple will flag it as a policy violation.

The rules I follow

  • Build it the second time you need it, not the first. The first time, you don't know what the shape is. The second time you can see what is shared and what is not.
  • Generate, don't hand-copy. The icon library is produced by a script. Hand-edited copies drift apart.
  • Make the data the thing that changes. Moving the promo strip's content into a JSON file turned a code change into a content change.
  • Keep apps able to work without it. The strip shows built-in content first and quietly swaps in the remote version if it loads. If the network fails, nothing breaks.

The cost, honestly

Reuse has a downside, and I have the scar to prove it. I copy the generated icon file into each app rather than publishing it as a proper library. That is simple and fast, but copies can carry mistakes.

I once had a wrong App Store link in the promo code. It was a dead page. Because it had been copied between apps, it ended up in six repositories before anyone noticed, and every iOS app that promoted ASVAB Prep was sending people to a page that did not exist.

The fix was a habit: never transcribe an ID, always verify it against the store, and make the check a one-line command. The lesson for reuse is that a shared mistake is also shared, so you want your checks to be shared as well.

When to make it a real library

Copying a generated file is fine at my scale. If you have a team, or the thing changes weekly, a real versioned library is worth it. My rule of thumb: stay with copying until the third time it hurts, then promote it.

What do you reuse across your projects? Tell me in the comments, and I'll write about the release pipeline next if there is interest.

Related reading

Tagged: software engineering · kotlin · code reuse · cross-platform · productivity · solo developer

Discussion

No comments yet. Be the first.