Swift value constant can mutate using Copy-on-Write (CoW) and multi-threading
gist.github.com
gist.github.com
It boils down to "I did a read-modify-write without a lock, now there is a bug". Of course there is! that's what locks are for!
The swift value system and copy-on-write do not somehow absolve you from locking.
So the race isn’t because COW over struct in swift isn’t atomic ( it is), but because he uses a class and tries to build cow over it ( but does so improperly) ?