且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

迅速等待异步任务

更新时间:2021-12-11 22:16:20

意识到我可以更改代码的结构:

Realized I could just change the structure of the code:

loadData()

if error {
    log.error("Error")
} else {
   processData()
}

DispatchQueue.main.asyncAfter(deadline: delay) {  //Delay = now + 0-2 seconds
  updateUI()
  cleanup()
}