Skip to content

rizumita/NSObject-Aspect

Repository files navigation

NSObject+Aspect

NSObject+Aspect is a category of aspect oriented programming for NSObject.

Sample

Inject before block

[NSString injectBlock:^(NSString *string, NSUInteger anIndex) {
    NSLog(@"%@ %u", string, anIndex);
} beforeSelector:@selector(substringToIndex:)];

NSString *aString=@"This is a text for sample.";
NSString *substring = [aString substringToIndex:4];

Cancel before block

[NSString separateBeforeBlockFromSelector:@selector(substringToIndex:)];  // Remove before block

Inject after block

[NSString injectBlock:^(NSString *string, NSUInteger anIndex) {
    NSLog(@"%@ %u", string, anIndex);
} afterSelector:@selector(substringToIndex:)];

NSString *aString=@"This is a text for sample.";
NSString *substring = [aString substringToIndex:4];

Cancel after block

[NSString separateAfterBlockFromSelector:@selector(substringToIndex:)];	// Remove after block

License

NSObject+Aspect is available under the MIT license. See the LICENSE file for more info.

About

NSObject+Aspect is a category of aspect oriented programming for NSObject of Objective-C

Resources

License

Stars

Watchers

Forks

Packages

No packages published