iOS: Animate TableView Updates

A better way to reload data

Stan Ostrovskiy
18 min readSep 23, 2017

Let’s be honest: tableView.reloadData is only there for two reasons:

  • to load initial data
  • to infuriate your internal perfectionist

Most data-driven apps use the server to fetch a new data and then display this data in the table view. When you reload the data, some of the items in your collection may not change, or the collection may only add/delete a few items without affecting all other items. Calling .reloadData() on the tableView will update the tableView instantly the scroll position will be ambiguous. Not the best user experience, right? In the most cases, you want smooth updates of appropriate sections and rows with a nice animation and without any flicks, jumps, or scrolls.

We will touch some advance and useful techniques, such as Protocol Conformance, Generics, Custom Subscripts (swift 4), Higher Order Functions, etc. Enjoy your reading!

In one of my previous articles, I created an example app, that displays the sectioned data of different types.

--

--