Method dispatcher and progress handler.
pod "ITActionManager"
Copy "ITActionManager" (and "NSInvocation+SimpleCreation" if you want to use the helper methods to build NSInvocation's) to your project and import when you want to use them.
#import "ITActionManager.h"
#import "NSInvocation+SimpleCreation.h"
// Invocations
NSInvocation *inv = [ITActionManager invocationWithTarget:yourTarget andSelector:@selector(yourSelector:)];
NSInvocation *inv2 = [ITActionManager invocationWithTarget:yourTarget2 andSelector:@selector(yourSelector2:)];
// Action manager
ITActionManager *actionManager = [[ITActionManager alloc] init];
[actionManager addActionsProgressHandler:^(float percentProgress) {
NSLog(@"Progress - %f", percentProgress);
}];
[actionManager addActionsResultHandler:^(float result) {
NSLog(@"Completed.");
}];
[actionManager performMethods:@[inv, inv2]];
Inspired by Sebastien Windal on Callback handlers using blocks