#CJAInvocationFilter The category adapts the before and after filter concept from Rails.
##Installation
Just drag & drop the NSObject+InvocationFilter.h
and NSObject+InvocationFilter.m
to your project.
##Example First of all take a look at the Example Project
##Usage
//import the category
#import "NSObject+InvocationFilter.h"
//Create or use your custom class
@interface TestObject : NSObject
- (void)doSomething;
@end
@implementation TestObject
- (void)doSomething {
NSLog(@"%s", __FUNCTION__);
}
@end
TestObject *object = [TestObject new];
//add the filters to the proxy object
[object setBeforeFilter: ^(NSObject *object){
NSLog(@"before filter");
}
forSelector: @selector(doSomething)];
[object setAfterFilter: ^(NSObject *object){
NSLog(@"after filter");
}
forSelector: @selector(doSomething)];
//call the original method on the proxy
[object doSomething];
##Note You cannot call methods that are implemented in the NSObject Protocol e.g. class, hash, superclass, description and so on.
##LICENSE Released under the MIT LICENSE