Sometimes, the smallest snippets of code..
Sometimes, the smallest snippets of code..
- Subject: Sometimes, the smallest snippets of code..
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 23 Jul 2001 05:10:47 -0700
I just squished a whole lot of code into considerably less code when I
implemented this:
@implementation NSInvocation (IX_InvocationExtensions)
- (void) invokeWithCollection: aCollection
/*"Invokes the reciever with every object contained in aCollection.
aCollection can be any object that responds to -objectEnumerator, which
includes arrays and sets."*/
{
id
obj;
NSEnumerator
*gimme = [aCollection objectEnumerator];
while (obj = [gimme nextObject])
[self invokeWithTarget:obj];
}
@end
I almost had a psychic girlfriend, but she left me before we met. --
Steven Wright