Swift Toolchain
Swift is included in Xcode. Otherwise, you can download the official Swift compiler and build tools from the Swift website:
As an example, if you use Ubuntu, you can download the gzipped tar file, and install it on your system. The most recent stable version of Swift, as of writing, is version 5.6.1.
$ tar xvzf swift-5.6.1-RELEASE-ubuntu20.04.tar.gz
$ sudo mv swift-5.6.1-RELEASE-ubuntu20.04 /opt/swift
Then you can add /opt/swift/usr/bin
to your system path,
for instance, by editing the PATH
variable in /etc/profile.
$ swift --version
Swift version 5.6.1 (swift-5.6.1-RELEASE)
Target: x86_64-unknown-linux-gnu
The swift
CLI command supports the following 5 subcommands:
swift build Build Swift packages
swift package Create and work on packages
swift run Run a program from a package
swift test Run package tests
swift repl Experiment with Swift code interactively (default)
What's Next
Now that we have a development environment set up, let's try creating a simple program.
- Next Step: Creating the first program in Swift
C C++ C# Clojure Crystal D Dart Erlang F# Go Haskell Java Javascript Julia Kotlin Lua Python Rust Scala Typescript