AssociatedObject
public final class AssociatedObject<T>
Template class that manages an association between two objects using Objective-C API.
-
Creates an associated value wrapper.
Declaration
Swift
public init(policy: objc_AssociationPolicy = .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
Parameters
policy
The policy for the association.
-
Getter and setting for the associated value.
Declaration
Swift
public subscript(index: AnyObject) -> T? { get set }
Parameters
index
The source object for the association.
Return Value
the current value for the getter and nil for the setter