Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // www.prioregroup.com
- #import <objc/runtime.h>
- void Swizzle(Class c, SEL orig, SEL newClassName)
- {
- Method origMethod = class_getInstanceMethod(c, orig);
- Method newMethod = class_getInstanceMethod(c, newClassName);
- if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
- class_replaceMethod(c, newClassName, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
- else
- method_exchangeImplementations(origMethod, newMethod);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement