how to call a fucntuon in main thread in swift code example Example: main thread swift DispatchQueue.main.async { self.tableView.reloadData() }