3 ms·
In my experience, there is a lot of opportunity for sharing code between mobile platforms that doesn't have any real downsides. Things like: - data structures
by realharo 10y ago
In my experience, there is a lot of opportunity for sharing code between mobile platforms that doesn't have any real downsides. Things like:
- data structures for your domain objects
- network code (just plug in an appropriate platform-specific driver)
- like you said, business logic - especially if the app has to work offline
- if you're using something like https://realm.io/ https://realm.io/, you could avoid a lot of duplication
Anything to do with the UI then has to be platform-specific of course.
- jorgemf 10y ago> - data structures for your domain objects not sure there are a problem since you have data classes in kotlin. I bet swift provides something similar. > - network code In Android you must use okhttp, and I guess there are similar powerful libraries in swift for this. > - if you're using something like https://realm.io/ https://realm.io/ Last time I checked it I decided to keep using SQLite as it allows me to do everything I want. Realm doesn't support "complex" SQL queries. Again, just business logic. But there is no too much apart from field validation or simplex operations to show the data (or it should be much more). Complex things must be in the server, that is the best way to share business logic among all your apps in all the platforms.
- relics443 10y agoFor anyone not that familiar with Android, "must use okhttp" refers to the fact that it is the best solution, not that it's the only solution.