Safer iOS Code with Strict Concurrency & Swift 6

Safer iOS Code with Strict Concurrency & Swift 6

I started preparing one of my iOS & watchOS apps for Swift 6 and strict concurrency.?Here are three things I learned:

1. You can start right now

With Xcode 15.4 and Swift 5.10, you don’t have to wait for Xcode 16 and Swift 6 final release in September.

2. Small steps are possible and totally fine

  1. Enable upcoming Swift features step by step and fix the warnings that pop up.
  2. You can find a full list of them (10 in total) by searching for SWIFT_UPCOMING_FEATURE in Xcode 16 build settings
  3. After you’re done, set the SWIFT_STRICT_CONCURRENCY setting to “complete” and fix the remaining warnings.

Bonus: When working with an SPM package, you can opt-in at the target level with the following setting: 
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]        

Find out more in the Migrating to Swift 6 guide on swift.org

3. Expect more issues & warnings than you anticipate

Take it easy - you don’t have to resolve all of them in one day. Just get started and commit small and often.


There’s also great content & help provided by Apple, like in this WWDC 2024 video. Starting on the migration soon will prevent you from being overwhelmed by warnings and issues when Xcode 16 is released.

How about you? Have you started migrating to Swift 6 yet?

Beat Rupp

iOS/Swift Consultant for Porsche, Bosch, Elli, Deutsche Bahn, Siemens and more

8 个月

Thanks for sharing this!

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了