HookBlock 1.0.0

HookBlock 1.0.0

Maintained by Orta Therox.



HookBlock 1.0.0

  • By
  • 杨胜浩

HookBlock

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Instructions

照搬 https://github.com/ebf/CTObjectiveCRuntimeAdditions ,方便使用,弄了个pods.

Installation

HookBlock is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'HookBlock'

Use

#import <CTBlockDescription.h>


// a test block.
BOOL(^testBlock)(BOOL animated, id object,NSURLRequest *str,int i) = ^BOOL(BOOL animated, id object,NSURLRequest *req,int i) {
	return YES;
};

// allocating a block description
CTBlockDescription *blockDescription = [[CTBlockDescription alloc] initWithBlock:testBlock];

NSMethodSignature *methodSignature = blockDescription.blockSignature;

for (int i = 0; i < methodSignature.numberOfArguments; i ++) {
	const char *argu = [methodSignature getArgumentTypeAtIndex:i];
	NSLog(@"%d个参数是:%s",i,argu);
}
    
2019-02-14 15:19:56.654417+0800 HookBlock_Example[42387:1059962] 第0个参数是:@?
2019-02-14 15:19:56.654667+0800 HookBlock_Example[42387:1059962] 第1个参数是:B
2019-02-14 15:19:56.654805+0800 HookBlock_Example[42387:1059962] 第2个参数是:@
2019-02-14 15:19:56.654930+0800 HookBlock_Example[42387:1059962] 第3个参数是:@"NSURLRequest"
2019-02-14 15:19:56.655052+0800 HookBlock_Example[42387:1059962] 第4个参数是:i

Author

chuqingr, [email protected]

License

HookBlock is available under the MIT license. See the LICENSE file for more info.