Calling tableView.reloadData() seems to initiate the reload on a different thread. If I immediately try to select a cell I've added to my data structure, it may not have been reloaded by the TableView yet. Is there a way to tell when the TableView has completed the reloadData() process. My actual code is:
DispatchQueue.main.async {
self.tableView.reloadData()
self.selectNode(node: newNode)
}
Where selectNode is my function to locate the TableViewCell displaying that node. Frequently, it fails because TableView hasn't re-displayed it yet. I can "brute force" a solution by inserting a wait loop that checks to see if TableView has requested all my rows since the reload, but I had hoped there was a more elegant solution. I'm also uncomfortable with wait loops in general.