I created this basic architecture to handle my networking stuff,
i wanted to keep it modular and structured:
public class NetworkManager {
public pr
I think you need to put self.dispatchGroup.leave()
inside the Alamofire
response handler. As written, you leave as soon as you queue the request.
queue.async(group: dispatchGroup) {
Alamofire.request(Content.url).responseJSON { response in
switch response.result {
case .success(let value):
let json = JSON(value)
// do some stuff and save to Content struct
Content.annotations += [Station(...)]
case .failure(let error):
print("error: ",error)
}
self.dispatchGroup.leave()
}
}