HomeiOS DevelopmentEnabling Concurrency warnings in Xcode 14 – Donny Wals

Enabling Concurrency warnings in Xcode 14 – Donny Wals


If you wish to be sure that your code adopts Swift concurrency as appropriately as potential in Swift 5.7, it is a good suggestion to allow the Strict Concurrency Checking (SWIFT_STRICT_CONCURRENCY) in your mission.

To do that, choose your mission’s goal and navigate to the Construct Settings tab. Be sure to choose All from the listing of settings that’s proven (Primary is the default) and sort Strict Concurrency within the searchbar to seek out the Strict Concurrency Checking construct setting.

The screenshot under reveals all of the related components so that you can see:

Screenshot of the strict concurrency checking settings

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 potential in the meanwhile.

You may 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 while you mark one in every of your sorts as Sendable. This mode is basically 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, primarily as they’ll work in Swift 6. Personally I might advocate enabling this setting for brand spanking new tasks the place you need all your code to be correctly checked instantly. In an current codebase this mode could be slightly too strict, however then again it would flag plenty of issues that might be obligatory in Swift 6.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments