Reusing code between mobile platforms


After years of writing iOS apps and backends I have finally ventured into Android development. Yes, I’m a little late to the party, and yes, it’s quite different from iOS development, not in terms of programming constructs, but in terms how it feels.

So I jump headlong into Android, plowing though samples, occasional reading, and bug fixing someone else’s code. It’s all good.

Majority of my initial involvement with Android has to do with the things I already know well. Persistence, business logic, downloading some JSON from the network, serialization, search, pagination, etc.

And then it hits me!
I’ve already done all of this before! On iOS version of the app!

After a bit of brain twisting I’ve decided to embark on a mini-journey with an admirable goal. The goal is to never repeat code that can be identical on different mobile platforms… and even beyond mobile.

A little more clarification on this objective. I am looking for something that’s fairly specific.

  • The shared code needs to be non visual. I have no intention of reusing UI components
  • The shared code needs to be based on some sort of open source framework. All of it. I have no interest in looking at someone else’s callstack without source code
  • The shade code needs to be easily tested on mac or pc as a series of unit tests
  • A large ecosystem of open source components


Next: my first lead – j2objc