AssociatedValueSupporting
public protocol AssociatedValueSupporting
Mechanica
Classes adopting this protocol can associate values to the object itself.
-
setAssociatedValue(_:forKey:andPolicy:)
Default implementationMechanica
Sets an associated value using a given key and association policy.
Default Implementation
Mechanica
Sets an associated value using a given key and association policy.
Declaration
Swift
func setAssociatedValue<T>(_ value: T?, forKey key: UnsafeRawPointer, andPolicy policy: objc_AssociationPolicy)
-
getAssociatedValue(forKey:)
Default implementationMechanica
Returns the value associated for a given key.
Default Implementation
Mechanica
Returns the value associated for a given key.
Declaration
Swift
func getAssociatedValue<T>(forKey key: UnsafeRawPointer) -> T?
Return Value
the value associated with the key.
-
removeAssociatedValue(forKey:andPolicy:)
Default implementationMechanica
Removes an associated value using a given key and association policy.
Default Implementation
Mechanica
Removes an associated value using a given key and association policy.
Declaration
Swift
func removeAssociatedValue(forKey key: UnsafeRawPointer, andPolicy policy: objc_AssociationPolicy)
-
removeAllAssociatedValues()
Default implementationMechanica
Removes all the associated values.
Default Implementation
Mechanica
Removes all the associated values.
Declaration
Swift
func removeAllAssociatedValues()