Created
August 27, 2013 07:10
-
-
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>.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (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