Skip to content

Instantly share code, notes, and snippets.

@vinnybad
Last active August 29, 2015 14:12
Show Gist options
  • Save vinnybad/ef68620c7ebf1e4f4034 to your computer and use it in GitHub Desktop.
Save vinnybad/ef68620c7ebf1e4f4034 to your computer and use it in GitHub Desktop.
void objc_setAssociatedObject ( id object, const void *key, id value, objc_AssociationPolicy policy );
// object = usually 'self'. This is the object you want to associate a key and value with.
// key = the key you want to associate the object with
// value = the value you want to associate with the key
// objc_AssociationPolicy is one of the below:
enum {
OBJC_ASSOCIATION_ASSIGN = 0,
OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1,
OBJC_ASSOCIATION_COPY_NONATOMIC = 3,
OBJC_ASSOCIATION_RETAIN = 01401,
OBJC_ASSOCIATION_COPY = 01403
};
// Get the associated object
id objc_getAssociatedObject ( id object, const void *key );
// Remove all associated object references
void objc_removeAssociatedObjects ( id object );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment