Swift.org Blog Holly Borla Sep 17, 2024

Announcing Swift 6

Article Summary

Holly Borla from Apple's Swift Core Team announces Swift 6, bringing data-race safety from opt-in warnings to compiler-enforced guarantees. After a decade of development, Swift now targets embedded systems, servers, and performance-critical code beyond just apps.

Swift 6 represents a major evolution of Apple's programming language, expanding beyond its million-app iOS ecosystem. The release introduces memory safety for concurrent code, embedded device support, and unified cross-platform libraries. Apple's Swift team has reimplemented Foundation entirely in Swift and launched Swift Testing as a built-in testing framework.

Key Takeaways

Critical Insight

Swift 6 transforms from an app development language into a systems programming language with compile-time concurrency safety, embedded device support, and true cross-platform consistency.

The new ownership system with non-copyable types and the @DebugDescription macro reveal how Swift is tackling performance at the language level.

About This Article

Problem

Swift developers using the `-strict-concurrency=complete` compiler flag in Swift 5.10 ran into a lot of false positives when checking for data-race safety. This made it hard to validate concurrent code without getting buried in noise, and scaling adoption became difficult.

Solution

Apple's Swift team tackled this by improving how Sendable inference works and adding new compiler analysis to handle transferring mutable state between actors. Swift 6 made data-race safety mandatory, and these changes cut down on false positives significantly.

Impact

On 10-core machines, Windows build performance jumped by up to 10x when the Swift package manager started using parallel compilation across multiple cores by default.