I have a for loop that runs an asynchronous network function in each loop, and I want to make it so that the loop only moves on after the network function has been completed.
for item in array {
theo.createNode(item.node, completionBlock: { (node, error) in
// callback
})
}
As seen in my code, I only want the loop to move onto the next item after the createNode function has been completed and callback is received. I'm not looking to run something after all the async functions in the array have run; I'm looking to run the async function in each item to completion before moving onto the next one. Is there any method or listener that accomplishes this?