-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor table view updates #130
Conversation
This supersedes #128. |
let visibleIndexPaths = self.tableView.indexPathsForVisibleRows ?? [] | ||
|
||
// Collect the index paths and views models to reload | ||
let indexPathsAndViewModelsToReload = visibleIndexPaths.compactMap { indexPath in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the visible row/section business is now handled by just reloading the table.
@@ -226,7 +198,9 @@ extension TableViewDriver: UITableViewDataSource { | |||
guard let tableViewModel = self.tableViewModel, let cellViewModel = tableViewModel[indexPath] else { | |||
fatalError("Table View Model has an invalid configuration: \(String(describing: self.tableViewModel))") | |||
} | |||
return tableView.configuredCell(for: cellViewModel, at: indexPath) | |||
let cell = tableView.configuredCell(for: cellViewModel, at: indexPath) | |||
cell.accessibilityIdentifier = cellViewModel.accessibilityFormat.accessibilityIdentifierForIndexPath(indexPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to only be handled by refreshViews
. By moving this here, we ensure this is always up-to-date.
Will wait to merge until I can test this against PG. |
b51fb54
to
d0ca935
Compare
This solution is un-tenable, if you have |
Changes in this pull request
This cleans up table view updates to no longer manually update cells and headers. All updates to the model now reload the table datasource. With diffing enabled, behavior is the same. This mainly improves behavior with diffing disabled: non-diffing updates can now tell if a full
reloadData
is necessary or ifbeginUpdates/endUpdates
can be used fo the model update.This change is covered by existing tests.
Checklist
CHANGELOG.md
for any breaking changes, enhancements, or bug fixes.