Hello, I have the following code:
for petition in petitions {
DispatchQueue.main.async {
EmailController.sharedInstance.sendPetitions(params: petition, completion: {
self.getPetitions()//Update the badge petitions
}, failure: { (errorCode, errorDescription) in
})
}
The problem is that of course the services are called one after the other even if they still have not received an answer, and what I want is precisely that they do not pass to the next item in the loop until the call of the service has not answered, Does anyone think of something? thanks