Skip to content

Instantly share code, notes, and snippets.

@bitomule
Created February 11, 2020 14:20
Show Gist options
  • Save bitomule/dc93778529b295e1607377f1b323f136 to your computer and use it in GitHub Desktop.
Save bitomule/dc93778529b295e1607377f1b323f136 to your computer and use it in GitHub Desktop.
@propertyWrapper
public struct Atomic<Value> {
private var value: Value
public init(wrappedValue: Value) {
self.value = wrappedValue
}
public var wrappedValue: Value {
_read {
yield value
}
_modify {
yield &value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment