Scroll to bottom after reload row issue

Im creating a chat using uiTableView. The response is send as streaming so I need to reload last cell até every response update. However when I do reload row and scroll to bottom, the content of the last cell seems to be drag to the bottom instead of looking as a regular scroll.

Answered by DTS Engineer in 823109022

@Camacho0710 Are you using diffable data sources? It handles automatically diffing sections & items for you, and generating the correct batch updates on the table view.

If you are then you’d use a combination of UITableViewDiffableDataSource + your own change detection for properties within existing items. You can call the reconfigure or reload APIs on the diffable snapshot as needed, to update content within existing views.

Updating collection views using diffable data sources sample project covers this. Please review the sample project and apply the learnings.

Accepted Answer

@Camacho0710 Are you using diffable data sources? It handles automatically diffing sections & items for you, and generating the correct batch updates on the table view.

If you are then you’d use a combination of UITableViewDiffableDataSource + your own change detection for properties within existing items. You can call the reconfigure or reload APIs on the diffable snapshot as needed, to update content within existing views.

Updating collection views using diffable data sources sample project covers this. Please review the sample project and apply the learnings.

Thank you very much! It actually helped with the glitch problem. However when I scroll sometimes some cells appears empty (as if the layout haven't updated yet).

Turns out the problem was on the configuration of the cell layout and reloading the data was nothing to do with the scroll bug. But thanks for your help anyway!

Scroll to bottom after reload row issue
 
 
Q