6 ms·
So, let me get this straight: * You can write part of your app in Go * You can share that code across your Android and iOS apps? Is that right? If so, seems
by wiremine 11y ago
So, let me get this straight:
* You can write part of your app in Go
* You can share that code across your Android and iOS apps?
Is that right? If so, seems like a solid use case for Go. Until Swift compiles to Android...
- anonova 11y agoI currently do this with Rust, as it can target both iOS [1] and Android [2], but you do have to build your own cross-compiler. [1]: https://github.com/rust-lang/rust-wiki-backup/blob/master/Doc-building-for-ios.md https://github.com/rust-lang/rust-wiki-backup/blob/master/Do... [2]: https://github.com/rust-lang/rust-wiki-backup/blob/master/Doc-building-for-android.md https://github.com/rust-lang/rust-wiki-backup/blob/master/Do...
- aikah 11y agoit's a good replacement for C if you were using it in Android or Ios. But you can't write classic Android or Ios apps with Go.You can however use Opengl so potentially write games, but using Cocoa and co? zip. Go on android doesn't even support android's own NDK ...
- steinnes 11y agoYeah, being able to compile and link a binary is pretty far from having a nice SDK :-)
- akhilcacharya 11y agoIs it really that beneficial to do this? Your system API's are still in Java/Obj-C/Swift, so all you can really share is business logic. Has anybody had any real benefit from doing this in the past? I know Facebook did it with moments, but the image processing code could at least be shared here.
- tl 11y agoDepending on how you structure your application, "business logic" may include persistence, network code, and everything that's not UI.
- threeseed 11y agoAnd even 99% of the business logic these days is pushed server side. I've worked on about 20 enterprise apps and they are nothing more than pretty API wrappers with some trivial functionality implemented on the phone.
- sandGorgon 11y agois that still correct after the Dalvik -> ART move ? I always thought a long term strategy around ART was to move away from the jvm dependency. Just in time for all the Oracle lawsuits confirming that Java apis are patent encumbered.
- s73v3r 11y agoART still uses dalvik bytecode.
- sandGorgon 11y agofrom my understanding, it uses dalvik bytecode (dex) as input format. but the resultant .oat files are binary/ELF [1] [1] http://newandroidbook.com/files/Andevcon-ART.pdf http://newandroidbook.com/files/Andevcon-ART.pdf
- on_and_off 11y agoNothing official but after all these efforts with ART and jack&Jill both of which are not tied to java, it seems likely that Google is at least experimenting with another language.
- 0x0 11y agoYou can do that with C and C++ as well. It's the native platform framework interfacing problem that usually makes this not as amazing as it sounds
- wiremine 11y agoAgreed. I guess the most amazing part is that you don't need C or C++.
- mahyarm 11y agoYou can actually do that with a lot of languages now. C# with xamarin, java/clojure with robovm, java with j2objc, etc. I was tempted with robovm, but found the 30s minimum build & run cycle for trivial code changes too slow for me. And the performance is pretty good for these guys, they're all as fast as objective-c: https://medium.com/@harrycheung/mobile-app-performance-redux-e512be94f976 https://medium.com/@harrycheung/mobile-app-performance-redux... At my last job we did the C++ cross platform layer, and it was very painful. C++ is slow to compile and can create bloated binaries. There can be something said for the freedom of having separate platform teams with just a server api.
- devsquid 11y agoRoboVM has been working pretty hard recently to cut the compile times down. I haven't used it in a year, but I read a blog post where Nick said he cut the compile times down by a ton. Plus he added incremental compiling recently as well, which should resolve your issue. :D
- mahyarm 11y agoThis was from me playing with it a week ago in the new robovm studio. It's still 30s with no code changes after you have built once, most of it being the robovm build part.
- yoklov 11y agoLong compile times and bloated binaries do come with the platform for C++, but (with experience) you get pretty good at minimizing both of those with little effort. This also tends to lead to a fairly clean dialect of C++ (closer to C), and has higher performance code as well. It basically boils down to not really using templates. That means no stl or boost, but (and this is not a popular opinion at all) this tends to lead to cleaner code, and more productive programmers. My experience is that templates do allow for more code reuse than you can typically get in other languages, however they do so at a high complexity and maintenance cost -- not to mention binary bloat and long compile times.
- nileshk 11y agoHaven't tried this myself, but Swift compiles to Android: http://elementscompiler.com/elements/silver/ http://elementscompiler.com/elements/silver/
- pjmlp 11y agoIt doesn't save you from JNI or Objective-C/Swift fun. Regardless of what is going on with Oracle, the Android team sees the NDK as a nuisance and only offers NDK APIs suitable for games. How does Go represent UIkit and similar APIs?