Created
February 11, 2020 14:20
-
-
Save bitomule/dc93778529b295e1607377f1b323f136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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