Saturday, January 6, 2024
HomeiOS DevelopmentEnabling Concurrency warnings in Xcode 15 – Donny Wals

Enabling Concurrency warnings in Xcode 15 – Donny Wals


If you wish to be sure that your code adopts Swift concurrency as accurately as attainable in Swift 5.9, it is a good suggestion to allow the Strict Concurrency Checking (SWIFT_STRICT_CONCURRENCY) flag in your undertaking.

To do that, choose your undertaking’s goal and navigate to the Construct Settings tab. Ensure you 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 elements so that you can see:

The default worth for this setting is Minimal which boils all the way down to the Compiler solely checking specific Sendable annotations amongst different issues. This setting is the least restrictive and enforces as little of Swift Concurrency’s constraints as attainable in the meanwhile.

You may bump your checking to Focused which is able to implement Sendable and actor-isolation checks in your code, and it’ll explicitly very that Sendable constraints are met while you mark considered one of your sorts as Sendable. This mode is basically a little bit of a hybrid between the habits that is supposed in Swift 6, and what’s allowed now. You should utilize 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 may work in Swift 6. Personally I’d advocate enabling this setting for brand new initiatives the place you need all your code to be correctly checked instantly. In an present codebase this mode could be just a little too strict, however then again it’s going to flag plenty of issues that will likely be necessary in Swift 6.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments