swift GCD异步请求接口,合并数据

let workingGroup = DispatchGroup()

let workingqueue = DispatchQueue(label: "request_queue")

workingGroup.enter()

workingqueue.async {

    Thread.sleep(forTimeInterval: 1)

    print("接口A请求完数据")

    workingGroup.leave()

}

workingGroup.enter()

workingqueue.async {

    Thread.sleep(forTimeInterval: 1)

    print("接口B完成请求数据")

    workingGroup.leave()

}

workingGroup.wait()

print("接口A和接口B的数据请求完毕,合并两个接口的数据")

你可能感兴趣的:(swift GCD异步请求接口,合并数据)