

Ask HN: Best way to share code on ios, android, desktop? - bhouston

I have a new project that I want to run everywhere fast. It is heavily based on opengl.  I need native uis on all platforms but I would like to share logic and rendering code. How can I do this in the modern way that is efficient?
======
cshipley
I have implemented application for clients using xamarin and have been
pleased. Portions of the code can truly be written once, compiled once and
bundled into iOS or Android, using portable class libraries. Xamarin can call
into native code on either platform, as well as has support for opengl.

That said, I don't think you could write cross platform opengl code unless
there was an abstraction. However, there is a framework called monogame, which
depending on what you're trying to do, may be useful. See
[http://www.monogame.net/showcase/](http://www.monogame.net/showcase/)

I keep a lot of business logic and networking code in shared modules, then
have the UI be very thin. These shared pieces can be tested on a desktop
system. The biggest negative about Xamarin is it feels like they push some
things out the door too soon, without sufficient quality or documentation.

If you have any questions, feel free to shoot me an email at curtis [at]
saltydogtechnology [dot] com.

~~~
bhouston
Thanks for the response, we'll start investigating Xamarin.

------
jparishy
Xamarin is a good option. You can also write your logic & rendering code in
C++, which you should be able to share across those platforms.

------
weishigoname
you can put your files on cloud, there are many free cloud storage tools, you
can try one.

