I am new to async and sync mechanism. In my code I have to perform one code line only after the other is done. It looks something like this:
func something(){
let workerQueue = DispatchQueue.global(qos: .userInitiated)
workerQueue.async{
let info = getInfoFromTheWeb()//I need the info value in order to perform the next line
saveToDB(info: info)
DispatchQueue.main.async {
//update a label text in the ui after getting and saving that info
}
}
}
Your professional thoughts please..