what is suggested for swift concurrency migration

Asked on 06/11/2025

1 search

For migrating to Swift concurrency, Apple suggests several strategies and settings to help with the transition:

  1. Approachable Concurrency Setting: It is recommended to enable the "Approachable Concurrency" setting in your app's build settings. This setting introduces features that make it easier to work with concurrency, especially for projects that interact primarily with the UI. For such projects, setting the default actor isolation to mainactor is advised, which ensures that code runs on the main actor unless specified otherwise. This helps in making single-threaded apps easier to write and provides a more approachable path to introducing concurrency when needed.

  2. Swift 6 Migration Tooling: Swift 6.2 includes migration tooling to help automate necessary code changes for concurrency. This tooling can be found under the Swift Compiler Concurrency section of Xcode Build Settings and can also be enabled in a Swift package manifest file using the Swift Settings API.

  3. Data Race Safety: Enabling strict checking in a target's build settings opts the entire module into being checked for possible race conditions. This is particularly useful for improving app quality by catching mistakes in concurrent code at compile time. It is recommended to start with enabling complete checking on simpler parts of the app, like the UI layer, which often runs on the main thread.

  4. Incremental Migration: It is advised to resist the temptation to blend significant refactoring with enabling data race safety. Instead, focus on one at a time to avoid overwhelming changes. Start with enabling complete checking and then proceed to refactor the app as needed.

  5. Community Involvement: Apple encourages developers to participate in the Swift community, such as on forums at swift.org, to help shape the future of Swift and provide feedback on concurrency improvements.

For more detailed guidance, you can refer to the session Embracing Swift concurrency and Migrate your app to Swift 6.