Posted By

0xced on 01/21/09


Tagged

swizzle swizzling


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

davidsi
cnathan


Method swizzling


 / Published in: Objective C
 

Method swizzling in Objective-C 2.0, from http://cocoawithlove.com/2008/03/supersequent-implementation.html

  1. Method myReplacementMethod = class_getClassMethod([MyClass class], @selector(myReplacementMethod));
  2. Method windowDealloc = class_getInstanceMethod([NSWindow class], @selector(dealloc));
  3. method_exchangeImplementations(myReplacementMethod, windowDealloc);

Report this snippet  

You need to login to post a comment.