How make multiple web services calls by serial queue in swift 4 (i.e. second call start after first call completion)
func allConcurretExce(completion: @escaping () -> ()) {
let queue = DispatchQueue(label: "reverseDomain", attributes: .concurrent)
let group = DispatchGroup()
queue.async (group: group) {
print("first call")
self.userSignIn()
}
queue.async (group: group) {
//group.wait(timeout : .now() + .seconds(3))
print("second call")
self.getMeData(token: self.token)
}
group.notify(queue: DispatchQueue.main) {
completion()
}
}
This is what I am doing when my first call completes i got token and send that token to another call.But what I am achieving now is getting both call at a time which is causing error in my second call.My aim is to get token from first and sent to second without using handler. I want to achieve this by queue.