What's sendable

Asked on 01/09/2025

1 search

In the context of Swift, "sendable" refers to a type that can be safely shared between different concurrency domains without causing data races. In Swift 6, ensuring data race safety is a key feature, and types that are shared across concurrency domains need to be marked as sendable. This is particularly important for public types, as Swift does not automatically infer sendability for them. Instead, developers must explicitly mark these types as sendable to guarantee that they do not contain mutable state that could lead to data races.

For example, in the session "Migrate your app to Swift 6," it is explained that if a type is public and shared outside of its module, it must be explicitly marked as sendable. This is because marking a type as sendable is a guarantee to clients that the type is safe to use across different concurrency domains.

If you want to learn more about this topic, you can refer to the session Migrate your app to Swift 6 (32:27).