Skip to content

Instantly share code, notes, and snippets.

@mhuusko5
mhuusko5 / NSArray – makeObjectsPerformSelector:withEnumerableArguments:
Last active October 19, 2015 12:24
NSArray – makeObjectsPerformSelector:withEnumerableArguments:
@implementation NSArray ()
- (void)makeObjectsPerformSelector:(SEL)selector withEnumerableArguments:(id<NSFastEnumeration>)arguments {
for (id object in self) {
if (object && [object respondsToSelector:selector]) {
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:object];
if (arguments) {