Shashank Guduru Shashank Guduru - 4 months ago 56
Swift Question

Swift 3 compiler in terminal

I've downloaded the Xcode 8.0 beta, which includes the updated Swift 3 compiler. Is it possible to use the Swift 3 compiler on the terminal?

For example, I can use the "Swift (filename)" command to compile and run Swift 2.2 code in the terminal.



Since you've already got Xcode 8 beta installed, this should work:


Smoke Test

$ /Applications/ -v
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)

Detailed Example

Here's a complete example using the example code for the Swift Package Manager.

$ git clone
Cloning into 'example-package-dealer'...
remote: Counting objects: 21, done.
remote: Total 21 (delta 0), reused 0 (delta 0), pack-reused 21
Unpacking objects: 100% (21/21), done.
Checking connectivity... done.

$ cd example-package-dealer/

$ /Applications/ build
HEAD is now at 0879cff Merge pull request #1 from kostiakoval/master
Compile Swift Module 'Dealer' (1 sources)
Linking .build/debug/Dealer

$ .build/debug/Dealer