5.7 · Swift 6 language mode and upcoming features

The compiler version and the language it accepts are two different dials. Understanding the difference is what makes a Swift 6 migration a series of small steps instead of one big one.

Mental model. A Swift 6 compiler can build Swift 5 code. Language mode decides which rules it enforces, and each module chooses its own.

Two dials

Compiler version versus language mode, and the checks that change.

  1. What is the difference between the Swift 6 compiler and Swift 6 language mode? 5.7.1 · L3
    The compiler version is the toolchain you build with (Xcode 16 ships Swift 6). The language mode (-swift-version, or the Swift Language Version build setting)…
  2. What are upcoming features and experimental features, and how do they help a migration? 5.7.2 · L5
    Many language changes are source-breaking, so they cannot simply be switched on for everyone. Instead each ships as an upcoming feature with its own name and…

Migrating

A staged plan for moving to Swift 6.

  1. How would you migrate a large codebase to Swift 6 without a freeze? 5.7.3 · L5
    Move in stages that each ship. First update the toolchain and your dependencies while every module stays in mode 5. Then switch on strict concurrency checking…

More in Compiler & language internals