Deep Dive • 24 June 2026 • Written by Lochan Chugh
Crossing the Border: Sendable vs. Non-Sendable Types
Crossing the Border: Sendable vs. Non-Sendable Types
In Swift 6, every time you move data between actors or into a background Task, you are crossing an Isolation Boundary. The compiler uses the Sendable protocol to ensure that this crossing doesn’t introduce data races.
The Hook: The Surprise Warning
You’ve just refactored a class to be an actor, and suddenly your entire networking layer is throwing “Non-sendable type cannot be passed” warnings. The temptation is to use @unchecked Sendable, but that is often a sign of architectural debt rather than a solution.
The “Why”: thread-safety by Categorization
Sendable is a marker protocol. It tells the compiler that a type can be safely shared across threads because it is either:
- Immutable: Like a
structwith onlyletproperties. - Internally Synchronized: Like an
actor. - Disconnected: Like a unique reference that the compiler can prove isn’t used anywhere else (Region-based Isolation).
The Implementation: Fixing the Leak
Instead of forcing a class to be Sendable, senior engineers look to Regional Isolation (SE-0414) to pass non-sendable objects safely.
class InternalBuffer { // Non-Sendable class
var data: [UInt8] = []
}
func processBuffer() async {
let buffer = InternalBuffer()
buffer.data = [1, 2, 3]
// In Swift 6, this is valid if 'buffer' is not used
// again in the caller's region.
await performRemoteAction(with: buffer)
}
func performRemoteAction(with buffer: InternalBuffer) async {
// buffer is now isolated to this task's region
}
By keeping the lifetime of non-sendable objects short and localized, you can avoid the complexity of making every single object in your system thread-safe.
The Verdict: Value Types First
- Pros: Guarantees no data races; forces cleaner architecture.
- Cons: Can be frustrating to refactor legacy class-heavy codebases.
- When to use: Always. Avoid
@unchecked Sendableunless you are wrapping a legacy C-library with proven thread-safety.
Internal Connectivity
- Foundation: Beyond Sendable: Region-based Isolation
- Next Step: Profiling Actor Hop Overhead in Instruments