What's new in concurrency?

Asked on 06/12/2025

2 searches

At WWDC, Apple introduced several updates and improvements to concurrency in Swift. Here are some of the key highlights:

  1. Data Race Safety: Swift 6 introduces a language mode that achieves data race safety by default, turning potential data race issues into compile-time errors. This significantly improves the security and stability of apps by preventing data races, which are common errors in concurrent programming (What’s new in Swift).

  2. Concurrency Language Changes: Swift 6.2 makes concurrency more approachable by allowing code to run on the main actor by default, reducing the risk of data races. When you start using async functions, they run wherever they're called from, maintaining data safety. You can offload specific code to the background to run in parallel when ready to embrace concurrency (What’s new in Swift).

  3. Swift Compiler Concurrency Settings: New language changes are opt-in and can be enabled under the Swift Compiler Concurrency section in Xcode Build Settings. Swift 6.2 includes migration tooling to help make necessary code changes automatically (What’s new in Swift).

  4. Concurrency in SwiftUI: SwiftUI now runs code concurrently in various ways, and Swift 6.2 introduces a new language mode that marks all types in a module with the @MainActor annotation implicitly. This helps in managing concurrency in SwiftUI apps more effectively (Explore concurrency in SwiftUI).

  5. Concurrency in Xcode 16: Xcode 16 supports Swift 6's data race safety guarantees, turning data races into compile-time issues. Developers can incrementally enable warnings for each upcoming language feature to prepare their apps for Swift 6 (What’s new in Xcode 16).

These updates aim to make concurrency in Swift more robust and easier to adopt, providing developers with tools to write safer and more efficient concurrent code.