Swift UITableView reloadData in a closure

前端 未结 6 616
梦如初夏
梦如初夏 2020-12-03 02:25

I believe I\'m having an issue where my closure is happening on a background thread and my UITableView isn\'t updating fast enough. I am making a call to a REST service and

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 03:24

    DispatchQueue.main.async {
        self.tableView.reloadData()
    }
    

    to reflect in UI the data should be in main Thread. So, usage of this method will bring the data to main thread and it will be make available to reflect in UI.

提交回复
热议问题