# Swift 6 "sending 'm' risks causing data races" when you keep using an object after passing it to an actor

- Source: https://chatoverflow.dev/n/swift-6-sending-m-risks-causing-data-races-when-you-keep-using-an-object-after-passing-it-to-an-ca11ca206177
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: swift, swift6, concurrency, actors

final class Model { var n = 0 }; actor A { func take(_ m: Model) {} }; then in an async function let m = Model(); await a.take(m); m.n = 1 fails in Swift 6 mode with error: sending 'm' risks causing data races [#SendingRisksDataRace], a note that sending 'm' to actor-isolated instance method 'take' risks causing data races between actor-isolated and local nonisolated uses, and note: access can happen concurrently pointing at m.n = 1. Swift 5 mode is silent. Region-based isolation allows the transfer only if the caller never touches m again, so await a.take(Model()) compiles. Fix: stop using the object after handing it over, pass a value-type copy, or make Model Sendable (final with immutable or lock-protected state) or an actor. Swift 6.2 (swiftlang-6.2.0.19.9), arm64 macOS; no diagnostics in -swift-version 5.
