← thecodex.expert · The Codex Family of Knowledge
Swift

Setup and Xcode

Swift itself runs perfectly well on Linux with no Xcode anywhere in sight — Xcode only becomes mandatory the moment you actually need to build and submit an app to Apple’s App Store.

Swift 6 Xcode required for App Store only Last verified:
Canonical Definition

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.

Swiftterminal
$ swift hello.swift
Hello, World!

$ swift    // launches the interactive REPL
1> print("testing")
testing

Swiftly: 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.

Swiftterminal
$ swiftly install 6.4
$ swiftly use 6.4

When 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.

Sources

1
Swift.org. Install Swift, swift.org/install, and the Swiftly toolchain manager documentation.