BTW if you are in SF, we are running a Swift hackathon @ GitHub HQ in a few weeks: http://www.swifthack.splashthat.com
Swift-X tool to cross compile Swift and Objective-C(++) code to Android
11–20 of 27 posts
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#12Earlier quoted context omitted.
Another viable — and possibly more enjoyable — approach would be to use C# for the full stack, irrespective of platform. See http://xamarin.com
No offense against C# (I like the language) but Xamarin is a commercial product https://store.xamarin.com/ which makes you dependent on Xamarin. Xamarin is definitely more advanced and I guess you can also do cross compiling UI apps. But before going the Xamarin road I would look more into QT.
Which is also commercial, unless you plan to release an open source app.
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#13Earlier quoted context omitted.
You can't just take a Swift app for iOS and compile it for Android, sure. But this could be useful for people who enjoy Swift, and want to reuse blocks of logic from their iOS app to an Android port. I'm wondering though, I thought Swift compiled down to code that uses things like the Foundation framework (NSString etc), which would also be missing on Android. It would be hard to do anything without these classes, wo…
There are several independent open-source implementations of Foundation like GNUStep and Cocotron. Once you have the Obj-C runtime and cross-compiler working, porting either of those to Android should be fairly simple... But I suspect that Swift may have dependencies on new or recent Foundation features which could be missing from the open-source versions (for understandable reasons, they lag behind Apple by several…
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#14Earlier quoted context omitted.
No offense against C# (I like the language) but Xamarin is a commercial product https://store.xamarin.com/ which makes you dependent on Xamarin. Xamarin is definitely more advanced and I guess you can also do cross compiling UI apps. But before going the Xamarin road I would look more into QT.
> But before going the Xamarin road I would look more into QT. Which is also commercial, unless you plan to release an open source app.
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#15When I wanted to code a foundation of reusable code for different devices I would either do it like Dropbox and use C++ as the most common layer http://oleb.net/blog/2014/05/how-dropbox-uses-cplusplus-cros... or use Javascript (which I can also use for web pages) for the program logic like described here http://www.skyscanner.net/blogs/developing-mobile-cross-plat... Also interesting http://kivy.org allows you to use…
My current prototype uses Java for all the backend / business logic (data base communication, file access, network access, threading etc.) and it communicates via a JavaScript bridge to a WebView UI layer for which I have targets for iOS (RoboVM), desktop (JavaFX), HTTP server (Jetty) and later possibly Android. All from a single Java code base which shares large amounts of code between the platforms.
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#16When I wanted to code a foundation of reusable code for different devices I would either do it like Dropbox and use C++ as the most common layer http://oleb.net/blog/2014/05/how-dropbox-uses-cplusplus-cros... or use Javascript (which I can also use for web pages) for the program logic like described here http://www.skyscanner.net/blogs/developing-mobile-cross-plat... Also interesting http://kivy.org allows you to use…
https://github.com/google/j2objc
I'm playing with it for a personal project, and as long as you're not too adventurous with your use of the JRE, it produces pretty usable Objective-C code.
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#17Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#18Earlier quoted context omitted.
> But before going the Xamarin road I would look more into QT. Which is also commercial, unless you plan to release an open source app.
Qt has been available under the LGPL for several years now.
Obviously every situation is unique.
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#19Earlier quoted context omitted.
Qt has been available under the LGPL for several years now.
For iOS?
Re: Swift-X tool to cross compile Swift and Objective-C(++) code to Android
#20One nice thing about clang is that there's no problem outputting Objective-C code that uses the Apple runtime on other platforms: just use -fobjc-runtime=macosx. The catch is that because class, protocol, etc definitions are just data, you need a way to get notified by the runtime linker when an object is mapped into the process address space. (You could scan the current address space at startup, but that makes it difficult to support dynamic loading, although probably not impossible now that I think about it. I thought I was nearly there with ld.so audit interface, but audit modules are loaded into their own namespace, so you can't easily communicate with the global libobjc.)