How can i wait to receive a response from a DispatchWorkItem before moving on to the next request or next DispatchWorkItem in a Dispatch Queue
问题 I have an array of dispatch workItems, how to wait until one work is completed before i move on to the next work in the queue? func AsyncCalls(statusHandler: @escaping (String) -> Void){ var dispatchWorkItems : [DispatchWorkItem] = [] let categoryWorkItem = DispatchWorkItem { main { return statusHandler("Loading categories ") } self.modelView.getCategories(completion: { data,error in main { if data.isEmpty { return statusHandler("\(error )") }else{ return statusHandler("Done loading