Theoretically, could Android run "all the apps" natively if they add support for Swift? Conversely, if Apple forked Android, could they do the same thing in reverse? I'm not taking sides, just curious what the experts think.
It is relatively easy to produce NDK outputs from Swift : <a href="https://github.com/swift-cc/tools" rel="nofollow">https://github.com/swift-cc/tools</a>
That's not very useful though. NDK is by design very limited and can't interact with almost any of the platform APIs<p>The Android framework team could theoretically make the necessary work to allow Swift code to :<p>-dialog with the framework APIs (so we would need need some kind of API bridge)<p>-compile to oat or bytecode format so that it can be read by ART (the vm used by android).<p>They would have to throw away and restart from scratch a lot fo the tooling though.<p>The Android frameworks team discussed the adoption of a new language during the fireside chat of the android dev summit.<p>The language in question was Kotlin (which would IMO a much bigger contender as the next language for Android). Their response was that adopting a new language means a massive amount of work for them and some very hard questions to answer like 'what about the people that still need/want to write in Java ?'.<p>Adopting Kotlin is not in their plans right now (it might change if in 2 years 90 % of the devs write their apps in Kotlin), especially since Kotlin already outputs bytecode, so it is 100 % compatible with the java APIs of Android.<p>This is even far less likely to happen with Swift :<p>-Apple controls the future of the language, Google can only lose from such a relationship.<p>-It is not compatible with the java APIs.
The language will compile, but all of the UI frameworks for iOS aren't available on other platforms.<p>It strikes me as similar to how .NET is cross platform. Command line apps will run, but anything with a GUI would have to be written with a cross-platform UI kit.