How do you start Swift on the command line? And how do you compile files on the command line with Swift 2.3? Since I updated to Xcode 8 I get Swift 3 by default.
<
UPDATE
To use Swift 2.3 prefix swift
with toolchain selection via xcrun
:
xcrun --toolchain "com.apple.dt.toolchain.Swift_2_3" swift --version
prints:
Apple Swift version 2.3 (swiftlang-800.10.12 clang-800.0.38)
Target: x86_64-apple-macosx10.9
OLD ANSWER
Use swiftenv to install and switch between Swift versions.
Install using Homebrew:
brew install kylef/formulae/swiftenv
Configure environment (zsh, for example):
echo 'if which swiftenv > /dev/null; then eval "$(swiftenv init -)"; fi' >> ~/.zshrc
List available versions:
swiftenv install --list
Install Swift 2.2:
swiftenv install 2.2