Try this:
tableView.backgroundColor = .black
tableView.reloadData()
DispatchQueue.main.async(execute: {
tableView.backgroundColor = .green
})
The tableView color will changed from black to green only after the reloadData()
function completes.