How do
Generated on 7/31/2024
1 search
To migrate your app to Swift 6, you can follow the detailed guidance provided in the session titled "Migrate your app to Swift 6" from WWDC 2024. Here are the key chapters that will help you through the process:
- Introduction - Overview of the session.
- The Coffee Tracker app - Example app used for the migration.
- Review the refactor from WWDC21 - Revisiting previous refactors.
- Swift 6 and data-race safety - Introduction to data-race safety in Swift 6.
- Swift 6 migration in practice - Practical steps for migration.
- The strategy - Strategies for a smooth migration.
- Adopting concurrency features - How to adopt new concurrency features.
- Enabling complete checking in the watch extension - Ensuring thorough checking in extensions.
- Shared mutable state in global variables - Handling shared mutable state.
- Shared mutable state in global instances and functions - Managing state in instances and functions.
- Delegate callbacks and concurrency - Integrating delegate callbacks with concurrency.
- Guaranteeing data-race safety with code you don’t maintain - Ensuring safety with third-party code.
- Enabling the Swift 6 language mode in the watch extension - Switching to Swift 6 mode.
- Moving on to CoffeeKit - Applying changes to a specific module.
- Enabling complete checking in CoffeeKit - Ensuring thorough checking in CoffeeKit.
- Common patterns and an incremental strategy - Patterns and strategies for incremental migration.
- Global variables in CoffeeKit - Handling global variables.
- Sending an array between actors - Managing data transfer between actors.
- What if you can’t mark something as Sendable? - Handling non-Sendable types.
- Enabling the Swift 6 language mode in CoffeeKit - Switching to Swift 6 mode in CoffeeKit.
- Adding a new feature with guaranteed data-race safety - Adding features with safety guarantees.
- Wrap up and the Swift 6 migration guide - Summary and additional resources.
For a specific example of enabling the Swift 6 language mode in CoffeeKit, you can refer to the timestamp Enabling the Swift 6 language mode in CoffeeKit (35:23) from the session "Migrate your app to Swift 6".
Relevant Sessions
Create a custom data store with SwiftData
Combine the power of SwiftData’s expressive, declarative modeling API with your own persistence backend. Learn how to build a custom data store and explore how to progressively add persistence features in your app. To get the most out of this session, watch “Meet SwiftData” and “Model your schema with SwiftData” from WWDC23.
Explore wellbeing APIs in HealthKit
Learn how to incorporate mental health and wellbeing into your app using HealthKit. There are new APIs for State of Mind, as well as for Depression Risk and Anxiety Risk. We’ll dive into principles of emotion science to cover how reflecting on feelings can be beneficial, and how State of Mind can be used to represent different types of mood and emotion.
Port advanced games to Apple platforms
Discover how simple it can be to reach players on Apple platforms worldwide. We’ll show you how to evaluate your Windows executable on Apple silicon, start your game port with code samples, convert your shader code to Metal, and bring your game to Mac, iPhone, and iPad. Explore enhanced Metal tools that understand HLSL shaders to validate, debug, and profile your ported shaders on Metal.
Migrate your app to Swift 6
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.