DEV Community

Viet Nguyen Tran
Viet Nguyen Tran

Posted on

What did you do when you want to share logic between iOS and android?

Hello,
My team is going to tackle a project with iOS and Android, both using native SDK. We want to share the data and logic between them, I mean data structure and design patterns. We'are planning to use Unit Test as the way to share the logic.
Is that a good way? If you already work on the same kind of problem, please share the lesson :). Thank you very much.

Top comments (4)

Collapse
 
kip13 profile image
kip

I think you need an API where both apps can communicate and this API have all(most) of the logic.
This API can be created in any languague or techonology, a good advantage.

For design process you can start with a mockup and try to apply it in both projects.

Collapse
 
vietstone_ng profile image
Viet Nguyen Tran

Yes, we're really looking for a way to share things between 2 platforms. Shared API and mockup are good start. I think we can share the same data structure and logic. But how to keep them synchronously between the two is the problem.
Can you share more about API have all (most) of the logic?

Collapse
 
kip13 profile image
kip

But how to keep them synchronously between the two is the problem.

This is more related in how each team(iOS & Android) is organized, I mean for every new change in the API each team should be work to apply it in the app.

Remember the API team is just one.

Can you share more about API have all (most) of the logic?

Imagine this:

I'm not an expert in mobile development but I'm gonna build something and this are the basic steps to start IMO.

You have alternatives to build the backend(API, Database, etc) more quickly, I think the most popular is Firebase, the advantage is the multiple amazing features that Firebase offers.


Collapse
 
valdirunars profile image
Þorvaldur Rúnarsson

I wrote a Programming Language 😂 Zolang for implementing a single source of truth for the logic in my micro services (Python), android (Kotlin) and iOS (Swift)