CInvocationGrabber is a Cocoa class to help with creating NSInvocation objects.
NSInvocation objects are Cocoa’s equivalent of “functors” and are extremely handy. But unfortunately creating them is often a pain. For example, take the following code showing how to create a simple NSInvocation:
NSInvocation *theInvocation = [NSInvocation invocationWithMethodSignature:[theString methodSignatureForSelector:@selector(insertString:atIndex:)]]; [theInvocation setSelector:@selector(insertString:atIndex:)]; [theInvocation setTarget:theString]; NSString *theFirstArgument = "Hello World"; [theInvocation setArgument:&theFirstArgument atIndex:2]; unsigned [...]