I want to create a method which run's a user's provided block of code, making use of dispatch groups, and has the implementation as follows:
dispatch_group_enter(self.group);
block(^ {
dispatch_group_leave(self.group);
if (completion) {
completion();
}
});
dispatch_group_wait(self.group, DISPATCH_TIME_FOREVER);
I'm not sure how to write the name of this method, however.
It'd be something similar to:
- (void)performBlock:(void(^)())block;
But then remember that the block provided has to have its own callback for completion.
The implementation would be something like this:
[object performBlock:^(void(^)() completion) {
//Do stuff
completion();
}];