-
Notifications
You must be signed in to change notification settings - Fork 42
An NSProxy based library for easily enabling AOP like functionality in Objective-C.
brodo/AOP-in-Objective-C
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
AOP in Objective-C This library enables functionality similar to AOP (Aspect Oriented Programming) for Objective-C. Proxy classes can be created (by wrapping the original instances in an instance of AOPProxy) that enable intercepting the beginning and the end of method invocations. It also provides two other classes AOPMethodLogger and AOPThreadInvoker - AOPMethodLogger will log automatically all method invocations for an object, and AOPThreadInvoker will make sure that no matter what thread is used to invoke the methods on your object they will always be executed on a specified thread. If you use this library I would be happy to hear about it :) – so please drop a mail to Szilveszter Molnar ( [email protected] ). For a simple example check this: - (void) addInterceptor:(NSInvocation *) i { NSLog(@"ADD intercepted."); } - (void) removeInterceptor:(NSInvocation *) i { NSLog(@"REMOVE END intercepted !"); } - (void) testAOP { NSMutableArray* testArray = [[AOPProxy alloc] initWithNewInstanceOfClass:[NSMutableArray class]]; [(AOPProxy*)testArray interceptMethodStartForSelector:@selector(addObject:) withInterceptorTarget:self interceptorSelector:@selector( addInterceptor: )]; [(AOPProxy*)testArray interceptMethodEndForSelector:@selector(removeObjectAtIndex:) withInterceptorTarget:self interceptorSelector:@selector( removeInterceptor: )]; [testArray addObject:[NSNumber numberWithInt:1]]; [testArray removeObjectAtIndex:0]; [testArray release]; }
About
An NSProxy based library for easily enabling AOP like functionality in Objective-C.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published