Hacker News new | ask | show | jobs
by bsimpson 3767 days ago
UI in Swift is heavily tied to Cocoa, right? What tools exist to draw UI in Swift on another platform?
1 comments

Swift doesn't have the slightest concept of UI. If you want to do UI work in Swift, you use whatever UI frameworks are available on your target platform. Since Swift interoperates very nicely with C and Objective-C, those frameworks can be written in those languages and still be usable from Swift. On OS X the framework happens to be Cocoa, but Swift isn't in any way tied to it.

On Android, Swift will likely be in the same position as the NDK, which isn't a great place to be for UI, but it's doable. You'll be able to make the same UI calls you'd make from C code.

And that there in is an issue. Android will never have a complete ndk API parity with Java. They've made this clear, and would be difficult since the Java API is implemented in Java (it's not a wrapper of ndk).
Don't expect to write entires Android apps in Swift. The best thing we can hope for is sharing crossplatform code among iOS, Android etc. And with Foundation ported this is fair amount of code.