Hacker News new | ask | show | jobs
by bmj 4467 days ago
As someone who has used several cross-platform frameworks (Titanium, Cordova/PhoneGap, investigating Xamarin), I have a question about going "full native": how do you handle shared core code? Our app has an engine that drives the business logic, and the cross-platform frameworks have been useful because we don't have to deal with modifying the core codebase for different platforms [0]. Is it possible to create platform-agnostic libraries that can be shared?

[0] Despite the many claims of "cross-platform UIs," we have many cases in our UI layer of doing different things on different platforms.

3 comments

Xamarin is great for sharing code. You just rewrite the GUI layer per platform. It's great, cannot really say it any differently.
And that GUI layer could be just Views in the end, since it seems you can even re-use ViewModels/Controllers.
This is the exact use case for Hexagonal/Clean Architecture: http://blog.groupbuddies.com/posts/20-clean-architecture

It is contentious on HN, but I implore you to draw your own conclusions.

If have read before that C++ can be used to share logic. An interesting development with iOS7 is that it has a JavaScript runtime of some sort (I don't know the details) - perhaps it will be possible to use JS for cross-platform code.
You're thinking of JavaScriptCore. It allows Objective-C objects to be used inside of JavaScript (and vice versa).

It's actually a pretty cool technology. I gave a talk about it this month at Berlin CocoaHeads, and I'm gonna put some blog posts together about it soon!

I presume the JSCore runtime bridges objects back and forth? Very cool!