Member-only story
How to manage a set of Async function in for — in block in Swift.
Mar 14, 2021
You might need to wait for a set of async calling to finish a final method. and In this case, let’s suppose you used the For syntax to call the parallel callings.
If you used one single async method, you can use handler. But if all method chained with together, it takes too much time.
Every call will not be executed as parallel
So you can use DispatchGroup. After every .leave() has been called as same as a count of .enter() has been called, the notify() will be called finally.