swiftlang/swift

Tool

Ensures the Swift toolchain (swift, swiftc) is available - Xcode CLT on macOS, swiftly on Linux, winget on Windows

The Swift toolchain — compiler (swiftc), REPL, and the Swift Package Manager (swift package, swift build, swift test). On macOS it ships with the Xcode Command Line Tools; on Linux it is installed via swiftly, the official swift.org toolchain manager.

Key Commands

CommandDescription
swift buildBuild a Swift package
swift testRun package tests
swift runBuild and run an executable target
swift package initScaffold a new package
swiftc file.swiftCompile a single file

Common Usage

bash
# Build and test a package
swift build
swift test

# Run an executable target
swift run my-tool --flag

# Check toolchain version
swift --version