Skip to content

Instantly share code, notes, and snippets.

@HHuckebein
Created August 27, 2013 07:10
Show Gist options
  • Save HHuckebein/6350520 to your computer and use it in GitHub Desktop.
Save HHuckebein/6350520 to your computer and use it in GitHub Desktop.
Helper method for method swizzling. Don't forget to import #import <objc/runtime.h>.
+ (void)swapInstanceMethodsForClass:(Class)cls selector:(SEL)sel1 andSelector:(SEL)sel2
{
Method method1 = class_getInstanceMethod(cls, sel1);
Method method2 = class_getInstanceMethod(cls, sel2);
method_exchangeImplementations(method1, method2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment