The Death of Unnecessary Thread Hopping: Inside Swift 6.2 Approachable Concurrency
Abstract
When Swift Concurrency was introduced, marking an async method as nonisolated on an actor often caused an immediate and unexpected context switch to the global cooperative pool on reaching an await. In Swift 6.2, NonisolatedNonsendingByDefault reverses that default, allowing async functions to inherit and preserve their caller's execution context. This paper steps through real execution traces to examine what changes in execution behaviour: how @concurrent replaces implicit hops, and how the change removes unnecessary context switching overhead in production iOS applications. The approach is deliberately concrete, following traces across @MainActor and custom global actors step by step rather than describing the behaviour in the abstract, because the earlier behaviour was difficult to reason about precisely for the same reason. Readers take away a precise runtime mental model of thread context inheritance in Swift 6.2 against earlier versions, and rules for when to rely on default context preservation and when to offload work explicitly with @concurrent.