Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created May 26, 2009 19:33
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 tolmasky/118243 to your computer and use it in GitHub Desktop.
Save tolmasky/118243 to your computer and use it in GitHub Desktop.
+ (void)initialize
{
if (self == MyClass)
return;
unsigned int count;
objc_property_t * properties = class_copyPropertyList(self, &count);
while (count--)
{
objc_property_t property = properties[count];
char * name = property_getName(name);
chat * method_name = PROPERTY_NAME_TO_METHOD_NAME(name);
SEL selector = sel_getUID(method_name);
IMP method = class_getMethodImplementation(self, selector);
class_replaceMethod(self, selector, NEW_METHOD_WRAPPING_method, ...);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment