Function

objc_setAssociatedObject

Sets an associated value for a given object using a given key and association policy.

Declaration

void objc_setAssociatedObject(id object, const void *key, id value, objc_AssociationPolicy policy);

Parameters

object

The source object for the association.

key

The key for the association.

value

The value to associate with the key key for object. Pass nil to clear an existing association.

policy

The policy for the association. For possible values, see objc_AssociationPolicy.

See Also

Associative References

objc_getAssociatedObject

Returns the value associated with a given object for a given key.

objc_removeAssociatedObjects

Removes all associations for a given object.