Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. let group = DispatchGroup()
  2. var text = ""
  3. for i in 0..<20 {
  4. group.enter()
  5. fetchData(i, delay: Double.random(in: 0...0.2)) {
  6. text += "\($0) - "
  7. group.leave()
  8. }
  9. }
  10. group.notify(queue: DispatchQueue.main) {
  11. print(text)
  12. exit(0)
  13. }
  14.  
  15. RunLoop.current.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement