How do I wait for several methods to be completed?
This is the objective-c solution:
self.dispatch_group = dispatch_group_create();
dispatch_group_notify(self.dispatch_group, dispatch_get_main_queue(), ^{
});
dispatch_group_leave(strongSelf.dispatch_group);
In Swift 3...
let dispatchGroup = DispatchGroup()
dispatchGroup.enter()
dispatchGroup.leave()
dispatchGroup.notify(queue: DispatchQueue.main) {...}
https://developer.apple.com/reference/dispatch/dispatchgroup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With