If you wish to be sure that your code adopts Swift concurrency as appropriately as attainable in Swift 5.7, it is a good suggestion to allow the Strict Concurrency Checking (SWIFT_STRICT_CONCURRENCY
) in your venture.
To do that, choose your venture’s goal and navigate to the Construct Settings
tab. Be sure you choose All
from the checklist of settings that’s proven (Primary
is the default) and sort Strict Concurrency
within the searchbar to search out the Strict Concurrency Checking
construct setting.
The screenshot under exhibits all of the related components so that you can see:
The default worth for this setting is Minimal
which boils all the way down to the Compiler solely checking express Sendable
annotations amongst different issues. This setting is the least restrictive and enforces as little of Swift Concurrency’s constraints as attainable in the interim.
You’ll be able to bump your checking to Focused
which can implement Sendable
and actor-isolation checks in your code, and it’ll explicitly very that Sendable
constraints are met whenever you mark one in all your sorts as Sendable
. This mode is actually a little bit of a hybrid between the habits that is meant in Swift 6, and what’s allowed now. You need to use this mode to have a little bit of checking in your code that makes use of Swift Concurrency with out an excessive amount of warnings and / or errors in your present codebase.
With Full
you’re going to get the complete suite of concurrency constraints, basically as they may work in Swift 6. Personally I’d suggest enabling this setting for brand spanking new initiatives the place you need all your code to be correctly checked instantly. In an present codebase this mode could be a little bit too strict, however alternatively it would flag numerous issues that will likely be necessary in Swift 6.