Closed eneko closed 8 years ago
Looks really great :100:
Sorry for not looking at it sooner :/
@eneko @duemunk Would it be better if it support notify?
simply add
public func notify(queue: dispatch_queue_t = GCD.mainQueue(), block: dispatch_block_t){
dispatch_group_notify(group, queue, block)
}
turn
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
// do something async
{
dispatch_group_leave(group);
}
dispatch_group_enter(group);
//do something async
{
dispatch_group_leave(group);
}
dispatch_group_notify(group, dispatch_get_main_queue()) {
};
into this
let group = AsyncGroup()
group.background {
// Run on background queue
}
group.utility {
// Run on utility queue, in parallel to the previous block
}
group.notify{
//Run on main queue
}
I like it. It will be a great non-blocking alternative to group.wait
.
Thanks, eneko. I will try my best to enhance the documentation.
AsyncGroup
AsyncGroup facilitates working with groups of asynchronous blocks.
Multiple dispatch blocks with GCD:
All modern queue classes:
Custom queues:
Wait for group to finish:
Custom asynchronous operations: