SKTaskManager

MIT License
Objective-C
iOS

1 image

Author

Description

Now its easy to manage asynchronous task whether its is sequential or parallel. Create SKTask as many as your async task you have (i.e. if you want to download 5 images asynchronously, then create 5 SKTasks)

SKTask *aTask=[SKTask taskWithBlock:^(id result, BlockTaskCompletion completion) {
    // your async task goes here i.e. image downloading in background
    // once task is completed call this block

    //completion(nil); //this is important otherwise next task will not be exexute
}];

Now add all SKTasks to array and call this method to perform task parallel. (i.e. All 5 images should start downloading at same time)

[SKTaskManager parallerOperations:arrTask completion:^{
    NSLog(@"all task completed");
}];

Call this method to perform task sequentially. (i.e. only one image should be downloaded at a time. once its finish then next should start)

[SKTaskManager sequenceOperations:arrTask completion:^{
    NSLog(@"all task completed");
}];

Tags