Your Second Swift 4 & iOS 11 App - Part 24: | Ray Wenderlich

Now's the time to add new checklist items! This video will walk you through the process.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4284-your-second-swift-4-ios-11-app/lessons/24

Hi

What is the benefit of using:

let indexPath = IndexPath(row: newRowIndex, section: 0)
let indexPaths = [indexPath]
tableView.insertRows(at: indexPaths, with: .automatic)

instead of:

tabelView.reloadData()

Thanks in advance

Best regard

Thomas Kirk

insertRows() updates only the new row by adding it to the existing table view. reloadData() updates the entire table view by rebuilding the whole thing from scratch and the ground up.

https://developer.apple.com/documentation/uikit/uitableview/1614879-insertrows
https://developer.apple.com/documentation/uikit/uitableview/1614862-reloaddata

I hope this helps. Thank you! :]

This topic was automatically closed after 166 days. New replies are no longer allowed.