My name is Steffan Andrews and I hail from beautiful Vancouver, Canada.
I'm a professional composer for film and TV with over 16 years of experience specializing in animated series.
I'm also a life-long coder since 1995. I have helped build numerous commercial Mac applications including Audio Design Desk and Dipper. In my spare time I build and maintain open-source packages for Swift and SwiftUI.
In its current implementation, @OTAtomicsThreadSafe is designed to work as a wrapper around variables installed in an object (class, struct, enum, etc.).
However it will strangely result in a data race when used on a variable declaration within a function. So this wrapper should not be used in this fashion.
The following code will almost always return a value that is less than 100:
Proposal
It is poor form to declare a local variable within a function and then attempt to mutate it concurrently. Better form is to take the value and pass it into a concurrent operation that can run synchronously within the method, then rely on the operation to return the fully mutated value, often by way of a completion handler closure which can be waited on.
It is not clear if there is a way to prevent the property wrapper from being used on variable declarations inside a method, as the compiler will not stop you from doing it.