CyanHall.com 创建于 2020-12-23, 上次更新:2021-03-30。
👉  github shields 如果有用请点赞。
    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