When should I Condor to Sendable?

Asked on 09/06/2024

1 search

In the context of migrating your app to Swift 6, you should consider marking a type as Sendable when you need to share values between concurrency domains, such as actors. Swift requires you to explicitly add Sendable conformances on public types because it doesn't infer sendability for public types automatically. This is to ensure that you are making a conscious decision to guarantee that the type contains no mutable state that could lead to data races.

For example, if you have a public type that you want to send between actors, you should mark it as Sendable to eliminate warnings and ensure data-race safety. This is particularly important when dealing with public types, as Swift does not automatically consider them sendable due to the potential for future changes that might introduce mutable state.

For more details, you can refer to the session Migrate your app to Swift 6 (32:27).