Build sample app through BUCK
Summary: This diff adds capabilty to build sample app through BUCK. Reviewed By: passy Differential Revision: D13697307 fbshipit-source-id: d7008bb4709b13384f65051631b365a0eceddfff
This commit is contained in:
committed by
Facebook Github Bot
parent
21dfe41fb4
commit
f47de92117
@@ -41,21 +41,21 @@
|
||||
[[self sharedInstance] swizzleSelector:selector class:aClass block:block];
|
||||
}
|
||||
|
||||
- (void)swizzleSelector:(SEL)selector class:(Class)aClass block:(void (^)(NSInvocation * _Nonnull))block {
|
||||
- (void)swizzleSelector:(SEL)selector class:(Class)aClass block:(void (^)(NSInvocation * _Nonnull))blk {
|
||||
if (![self.swizzledClasses containsObject:aClass]) {
|
||||
SEL fwdSel = @selector(forwardInvocation:);
|
||||
Method m = class_getInstanceMethod(aClass, fwdSel);
|
||||
__block IMP orig;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
IMP imp = imp_implementationWithBlock(^(id self, NSInvocation *invocation) {
|
||||
IMP imp = imp_implementationWithBlock(^(id this, NSInvocation *invocation) {
|
||||
NSString * selStr = NSStringFromSelector([invocation selector]);
|
||||
void (^block)(NSInvocation *) = weakSelf.swizzledBlocks[aClass][selStr];
|
||||
if (block != nil) {
|
||||
if (blk != nil) {
|
||||
NSString *originalStr = [@"comfacebookFlipperKit_" stringByAppendingString:selStr];
|
||||
[invocation setSelector:NSSelectorFromString(originalStr)];
|
||||
block(invocation);
|
||||
} else {
|
||||
((void (*)(id, SEL, NSInvocation *))orig)(self, fwdSel, invocation);
|
||||
((void (*)(id, SEL, NSInvocation *))orig)(this, fwdSel, invocation);
|
||||
}
|
||||
});
|
||||
orig = method_setImplementation(m, imp);
|
||||
@@ -66,7 +66,7 @@
|
||||
classDict = [NSMutableDictionary dictionary];
|
||||
self.swizzledBlocks[(id)aClass] = classDict;
|
||||
}
|
||||
classDict[NSStringFromSelector(selector)] = block;
|
||||
classDict[NSStringFromSelector(selector)] = blk;
|
||||
Method m = class_getInstanceMethod(aClass, selector);
|
||||
NSString *newSelStr = [@"comfacebookFlipperKit_" stringByAppendingString:NSStringFromSelector(selector)];
|
||||
SEL newSel = NSSelectorFromString(newSelStr);
|
||||
|
||||
Reference in New Issue
Block a user