Contents

objc_setAssociatedObject(_:_:_:_:)

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

Declaration

func objc_setAssociatedObject(_ object: Any, _ key: UnsafeRawPointer, _ value: Any?, _ policy: objc_AssociationPolicy)

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