How do I have a async task inside a while loop I currently have this
myGroup = DispatchGroup()
while *condition* {
myGroup.enter()
query.getDocuments { (blah, blah) in
arr.append(docs)
//...
}
myGroup.leave()
}
completion(arr)
enter code here
this doesnt not work because it just immediatly goes back up to the while loop while skipping the async .getDocuments part