Skip to content

Instantly share code, notes, and snippets.

@inailuy
Created August 22, 2013 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inailuy/6314027 to your computer and use it in GitHub Desktop.
Save inailuy/6314027 to your computer and use it in GitHub Desktop.
Attaching a Variables to a object at run time
id obj;
// Creating a variable at run time
objc_setAssociatedObject(obj,@"variable", variable, OBJC_ASSOCIATION_RETAIN);
// Accessing the variable later
objc_getAssociatedObject(obj,@"variable");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment