The swift command-line tool (compiler, REPL, package manager) installs independently of Xcode on Linux and Windows, and swift.org provides official toolchain installers alongside Swiftly, a toolchain version manager for switching between Swift releases easily. Xcode, macOS-only, remains genuinely required for anything targeting Apple's platforms for actual distribution — it bundles the iOS/macOS SDKs and code-signing tools a real App Store submission needs, none of which the standalone Swift toolchain alone provides. Interface Builder (the drag-and-drop storyboard/.xib editor) is NOT one of those requirements — it's an optional authoring tool; a 100% programmatic UIKit app or a pure SwiftUI app with no storyboard at all is fully App-Store-eligible.
Running Swift without Xcode at all
None of this requires macOS or Xcode — the swift command runs a script directly, exactly like a Python or Node.js script, on any platform with the toolchain installed.
$ swift hello.swift
Hello, World!
$ swift // launches the interactive REPL
1> print("testing")
testingSwiftly: managing multiple toolchain versions
Swiftly installs and switches between Swift toolchain versions cleanly, similar to how nvm manages Node.js versions or rustup manages Rust — genuinely useful when different projects target different Swift versions.
$ swiftly install 6.4
$ swiftly use 6.4When Xcode becomes mandatory
Building a real iOS or macOS app for actual users — with UI, App Store submission, and code signing — genuinely requires Xcode's bundled SDKs and tools, none of which the standalone Swift toolchain provides on its own; server-side Swift or command-line tools, by contrast, need no Xcode at all.