Created
July 7, 2020 15:24
-
-
Save inso-/72e0c31e77b6c5204e7217ef336da440 to your computer and use it in GitHub Desktop.
PropertyData Accessor
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 class Property<T: Any> { | |
public var wrappedValue: T? { | |
get { PropertyData.get(key) ?? nil } | |
set { PropertyData.set(key, value: newValue as Any) } | |
} | |
let key: Weak<AnyObject> | |
public init(_ key: AnyObject) { | |
self.key = Weak(key) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment