Make section diffingKey
parameter required
#147
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes in this pull request
Issue fixed: n/a
As discussed with @benasher44 and @noahsark769, this updates the initializers for
TableSectionViewModel
andCollectionSectionViewModel
so that thediffingKey
argument is required.This prevents accidental misuse of the automatic diffing API, which is possible if you rely on the current default parameter value. 😅
No new behavior here, just a breaking API change. Tests are updated accordingly (no new ones).
Note on the parameter positioning
Previously
diffingKey
was the last parameter in each initializer. I chose to make it the first in the argument list:diffingKey
close to the bottom as the last required parameter, it divides the required argument for the collection/table view models from the optional arguments for header and footer like so 🤮I like it at the beginning better because it kind of looks like a section name. Open to discussion if there are any objections, though!
Checklist
CHANGELOG.md
for any breaking changes, enhancements, or bug fixes.