Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.
Discuss this video on the Apple Developer Forums:
https://developer.apple.com/forums/topics/programming-languages-topic?cid=yt-w-0011
Explore related documentation, sample code, and more:
Swift 6 Migration Guide: https://www.swift.org/migration/documentation/migrationguide/
Updating an app to use strict concurrency: https://developer.apple.com/documentation/Swift/updating-an-app-to-use-strict-concurrency
Swift concurrency: Update a sample app: https://developer.apple.com/videos/play/wwdc2021/10194
00:00 - Introduction
00:33 - The Coffee Tracker app
00:45 - Review the refactor from WWDC21
03:20 - Swift 6 and data-race safety
04:40 - Swift 6 migration in practice
07:26 - The strategy
08:53 - Adopting concurrency features
11:05 - Enabling complete checking in the watch extension
13:05 - Shared mutable state in global variables
17:04 - Shared mutable state in global instances and functions
19:29 - Delegate callbacks and concurrency
23:40 - Guaranteeing data-race safety with code you don’t maintain
25:51 - Enabling the Swift 6 language mode in the watch extension
26:35 - Moving on to CoffeeKit
27:24 - Enabling complete checking in CoffeeKit
27:47 - Common patterns and an incremental strategy
29:55 - Global variables in CoffeeKit
31:05 - Sending an array between actors
33:53 - What if you can’t mark something as Sendable?
35:23 - Enabling the Swift 6 language mode in CoffeeKit
35:59 - Adding a new feature with guaranteed data-race safety
40:43 - Wrap up and the Swift 6 migration guide
More Apple Developer resources:
Video sessions: https://apple.co/VideoSessions
Documentation: https://apple.co/DeveloperDocs
Forums: https://apple.co/DeveloperForums
App: https://apple.co/DeveloperApp