
If Swift runs on Linux, and Android is Linux, won't Android have the most apps? - pjbrunet
Theoretically, could Android run &quot;all the apps&quot; natively if they add support for Swift? Conversely, if Apple forked Android, could they do the same thing in reverse? I&#x27;m not taking sides, just curious what the experts think.
======
on_and_off
It is relatively easy to produce NDK outputs from Swift :
[https://github.com/swift-cc/tools](https://github.com/swift-cc/tools) That's
not very useful though. NDK is by design very limited and can't interact with
almost any of the platform APIs

The Android framework team could theoretically make the necessary work to
allow Swift code to :

-dialog with the framework APIs (so we would need need some kind of API bridge)

-compile to oat or bytecode format so that it can be read by ART (the vm used by android).

They would have to throw away and restart from scratch a lot fo the tooling
though.

The Android frameworks team discussed the adoption of a new language during
the fireside chat of the android dev summit.

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
?'.

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.

This is even far less likely to happen with Swift :

-Apple controls the future of the language, Google can only lose from such a relationship.

-It is not compatible with the java APIs.

~~~
pjbrunet
"Apple controls the future of the language, Google can only lose from such a
relationship."

I didn't think of that, but makes perfect sense. I haven't heard of Kotlin,
thanks for sharing. Personally, I think the "massive amount of work" would be
worth it, considering they can afford to hire more developers.

If you ask me, anything would be better than this weird Eclipse plugin
concept, not very sexy. Granted, I have not researched it more than a few
hours, but if "Hello World" requires a certain bloated IDE and multiple pages
of code, I want nothing to do with that. I did find DroidScript and that looks
like fun, but I haven't tried it yet.

Strictly from a marketing perspective, the name "Swift" just sounds easy and
intuitive, which is maybe the opposite of Java's reputation at this point.

~~~
on_and_off
>weird Eclipse plugin

That's the standard to add new languages to Eclipse, nothing weird with that.
The Eclipse plugin has been deprecated for a long time though, and Android
Studio (based on IntelliJ) is the official IDE of the platform.

------
jakejake
The language will compile, but all of the UI frameworks for iOS aren't
available on other platforms.

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.

~~~
sdegutis
That said, Microsoft did port iOS frameworks to their native frameworks, so
that iOS apps can run without code changes on Microsoft platforms.

------
tiredwired
Swift is just a programming language not an OS. You can program in C/C++ on
Android and iOS if you want to and forget about Swift.

