A toolchain is a set of tools that compiles source code into executables that can run on your target device and normally includes a compiler, a linker, and run-time libraries.
The Swift language is managed as a collection of projects, each with its own repositories. The current list of projects, according to swift.org, includes:
- The Swift compiler command-line tool
- The standard library bundled as part of the language
- Core libraries that provide higher-level functionality
- The LLDB debugger which includes the Swift REPL
- The Swift package manager for distributing and building Swift source code
- Xcode playground support to enable playgrounds in Xcode.
An Xcode toolchain (
.xctoolchain) includes a copy of the compiler, lldb, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift.
The default location for the downloadable toolchain on macOS is
/Library/Developer/Toolchains. You can make the latest installed toolchain available for use from the terminal with the following command:
$ export TOOLCHAINS=swift
I recommend this blog post from Shashikant Jagtap on how to switch Swift versions inside Xcode (or for the command-line).
If you just want to know which Swift version is used in which Xcode version then this community page helps you out: swiftversion.net