swift-evolution/proposals/0302-concurrent-value-and-concurrent-closures.md at main · swiftlang/swift-evolution · GitHub
TheSendable
protocol models types that are allowed to be safely passed across concurrency domains by copying the value.
Why Dictionary crashed on concurrency write? - #2 by John_McCall
As a general rule in Swift, you must not access the same variable (or property, or so on) multiple times concurrently unless all the accesses are reads. Assignments to elements of a dictionary are considered to be modifications of the dictionary as a whole, so your code is in violation of that.It is a goal of the concurrency feature that we've been working on to diagnose this problem at compile time. If you enable the strict concurrency checking in Swift 5.7, you should already get a diagnostic for this, at least if the dictionary is a local variable; global variables, including top-level variables in playgrounds, will not necessarily get the same diagnostic.
Swift does not currently provide a concurrent dictionary that allows different keys to be safely modified from multiple threads at once.