Method swizzling


/ Published in: Objective C
Save to your folder(s)

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


Copy this code and paste it in your 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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.