Skip to content

Instantly share code, notes, and snippets.

@inso-
Created July 7, 2020 15:24
Show Gist options
  • Save inso-/72e0c31e77b6c5204e7217ef336da440 to your computer and use it in GitHub Desktop.
Save inso-/72e0c31e77b6c5204e7217ef336da440 to your computer and use it in GitHub Desktop.
PropertyData Accessor
@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