jrswizzle
jrswizzle copied to clipboard
one-stop-shop for all your method swizzling needs
I attempted to swizzle the class method `JSONObjectWithData:options:error:` like this: ``` + (void) load { static dispatch_once_t sInitToken; dispatch_once(&sInitToken, ^{ __block NSInvocation* invocation = nil; NSError* err = nil; invocation...
``` @implementation UIViewController (Swizzling) + (void)load { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ SEL originSelector = @selector(viewWillAppear:); SEL swizzleSelector = @selector(sw_viewWillAppear:); [self jr_swizzleMethod:originSelector withMethod:swizzleSelector error:nil]; }); } - (void)sw_viewWillAppear:(BOOL)animated { [self...
Swizzling with a block requires using a single NSInvocation instance to call the original method. But if you need to set arguments on that invocation, you might be stepping on...
In order to use the latest version of this pod as a dependency of another pod, the podspec needs to be on the official repo: https://github.com/Cocoapods/Specs. Currently, it only knows...
Hi, Jonathan ``` Can Can i use swizzle a method witht a block implementation ``` Normal swizzleMetod:(SEL)slector withSelctor:(SEL)newSelector But I want this swizzleMetod:(SEL)slector withBlock:(^ )block because I cannot import WebView(In...
https://github.com/rentzsch/jrswizzle/blob/semver-1.x/JRSwizzle.m#L54 Why need call class_addMethod? can not ensure origMethod is exist ?
In [NSHipster - Method Swizzling](http://nshipster.com/method-swizzling/), it say: **Swizzling should always be done in a dispatch_once.**. My question is: should I need using dispatch_once when I use JRSwizzle?