Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.2 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.2 KB

ITActionManager

Method dispatcher and progress handler.

Installation with CocoaPods (Podfile)

pod "ITActionManager"

Manual installation

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"

Example

// 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