Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let group = DispatchGroup()
- var text = ""
- for i in 0..<20 {
- group.enter()
- fetchData(i, delay: Double.random(in: 0...0.2)) {
- text += "\($0) - "
- group.leave()
- }
- }
- group.notify(queue: DispatchQueue.main) {
- print(text)
- exit(0)
- }
- RunLoop.current.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement