Skip to main content
edited tags
Link
rmaddy
  • 319.5k
  • 44
  • 548
  • 591
Post Closed as "Duplicate" by Martin R ios
Source Link
moonvader
  • 21.3k
  • 20
  • 73
  • 127

Execute code after number of async methods

Let's say I got Int array and array for some class instances

var IDs = [Int]() var items = [Item]() 

For every item in IDs array I want to run async function to request item from server

for id in IDs { let item = requestItem(id) items.append(item) } 

As requestItem works in async way - how can execute code only after all items are loaded?