what is sendable
Asked on 2024-07-30
6 searches
In Swift, a "sendable" type is one that can be safely shared between different concurrency domains, such as actors or threads, without causing data races. A sendable value protects its state from concurrent accesses, ensuring data race safety.
For example, a type might qualify as sendable if it acquires a lock while reading and writing mutable state. Swift requires explicit conformance to the Sendable protocol for public types to guarantee to clients that the type contains no mutable state that could lead to data races. This is particularly important for public types because it prevents premature locking of sendability, allowing for future changes without breaking guarantees.
Here are some relevant segments from the WWDC sessions:
- In the session Migrate your app to Swift 6, it is explained that Swift does not infer sendability for public types automatically. You need to explicitly add sendable conformances on public types to avoid data race warnings.
- The session A Swift Tour: Explore Swift’s features and design discusses how data race safety is achieved by requiring that values shared between concurrency domains are sendable.
Relevant Sessions

What’s new in App Intents
Learn about improvements and all-new features with App Intents, and discover how this framework can help you expose your app’s functionality to Siri, Spotlight, Shortcuts, and more. We’ll show you how to make your entities more meaningful to the platform with the Transferable API, File Representations, new IntentFile APIs, and Spotlight Indexing, opening up powerful functionality in Siri and the Shortcuts app. Empower your intents to take people deep into your app with URL Representable Entities. Explore new techniques to model your entities and intents with new APIs for error handling and union values.

Consume noncopyable types in Swift
Get started with noncopyable types in Swift. Discover what copying means in Swift, when you might want to use a noncopyable type, and how value ownership lets you state your intentions clearly.

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.
