Does Swift compile to native code?
SwiftSwift Problem Overview
Simple question really, however there doesn't seem to be a straight answer in the https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html">current developer documentation.
Does Swift compile to machine language (i.e. assembly), or does it compile to some intermediary form that then runs on a virtual machine?
(I suspect it does, but being unfamiliar with development in Apple's world it is not clear to me like it may be to someone who is.)
Swift Solutions
Solution 1 - Swift
Yes, it compiles to machine language by way of LLVM Bitcode and, as @connor said, runs on top of the Objective-C runtime.
Solution 2 - Swift
Swift not only compiles to native machine code but it has also been designed specifically for it. Unlike e.g. Java which has been designed specifically as a JITed language. By that I mean Swift achieves best performance with ahead of time compilation while Java benefits most from JITing.
There are many reasons for these design choices but among them is that Swift has a much bigger scope than managed languages like Java. It is supposed to work on both desktop computers and phones with more restricted hardware. You can use Swift as a systems programming language unlike say C#, Java or Python because it has little runtime requirements and allow fairly detailed control of memory. So in theory one should be able to build an OS kernel with Swift which would be difficult with say Java.
Solution 3 - Swift
Swift, just like objective-c compiles to native code using llvm
A good explanation can be found in Apple's top secret Swift language grew from work to sustain Objective C, which it now aims to replace
From that article, talking about Swift
> The compiler is optimized for performance, and the language is > optimized for development, without compromising on either.
Solution 4 - Swift
Swift, like Objective-C, is compiled to machine code that runs on the Objective-C runtime.