What are the changes to swift concurrency

Asked on 06/11/2025

1 search

The changes to Swift concurrency, as presented at WWDC, focus on making concurrency more approachable and safer by default. Here are some key updates:

  1. Data Race Safety: Swift 6 introduces 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 unexpected runtime behavior and crashes due to data races. This feature is part of the new Swift 6 language mode, which is opt-in and can be adopted module by module (What’s new in Swift).

  2. Concurrency Model: Swift 6.2 changes the concurrency model to be single-threaded by default until concurrency is explicitly introduced. This makes it easier to write data race-free code by default and provides a more approachable path to introducing concurrency when needed (What’s new in Swift).

  3. Async Functions: It is now easier to call async functions on types with mutable state. Instead of offloading async functions that aren't tied to a specific actor, they continue to run on the actor they were called from, eliminating data races (What’s new in Swift).

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

  5. Main Actor Defaults: Swift 6.2 allows configuring modules or individual files to run on the main actor by default, making it easier to write single-threaded code without additional annotations. This is particularly useful for UI code that is not intended to run in parallel (Platforms State of the Union).

These changes aim to make Swift concurrency more accessible and safer, allowing developers to introduce concurrency as needed without fear of creating hard-to-fix data races.