Created by CyanHall.com on 12/23/2020 , Last updated: 03/30/2021.
👉  github shields Star me if it’s helpful.
    var photos = [[String: String]] = []
var photoMap: [Data: String] = [:]
let group = DispatchGroup()
// Upload photo
for imageData in imageDataList {
    group.enter()
    DispatchQueue.global().async {
        API.updateFile(data: imageData, success: { (url) in
            photoMap[imageData] = url
            group.leave()
        }) { (error) in
            group.leave()
        }
    }
}
// All photo uploaded
group.notify(queue: DispatchQueue.main) {
    for imageData in imageDataList {
        let item = [
            "url": photoMap[imageData]!,
        ]
        photos.append(item)
    }
    print(photos)
}
  

Maitained by Cyanhall.com, Copy Rights @ CC BY-NC-SA 4.0     ExcelRoadMap