How to update a UITableViewCell without reloading the full table

We have a table view setup and is working fine now suppose the data changes in the data source and you have to reflect that change in UITableView. At first, it seems that this problem can be solved easily by using tableview.reloadData(). Using reloadData works for a small tableview but when the table view is very large reloading the entire tableview will have its own issue.

The solution is to update only the target UITableViewCell. This can be done by using reloadRows. An example is given below

//Data source changed at index 10
let indexPath = IndexPath(row:10, section:0)
tableView.reloadRows(at: [indexPath], with: .automatic) // you can provide multiple indexPaths at once in the array.

This will update the specific cell without reloading full tableview.

NEED A JOB? NEED TO HIRE? NEED HELP?

Join group of Software Professionals

iOS DEVELOPER’S DEN