mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 09:18:29 +00:00
Make explicit IGListDiffable protocol requirement
Summary: While the CocoaDocs for the [IGListDiffable](https://instagram.github.io/IGListKit/Protocols/IGListDiffable.html) state that IGListDiffable objects should not mutate their `diffIdentifier` that requirement is not clear in this guide. This is a documentation only PR. Issue fixed: #880 - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/881 Reviewed By: ryanolsonk Differential Revision: D5547277 Pulled By: rnystrom fbshipit-source-id: 68d6f18f9c5bbb28d2c7071b67e8f89624258d81
This commit is contained in:
parent
7d33065b88
commit
85afdfa54b
1 changed files with 2 additions and 0 deletions
|
|
@ -80,6 +80,8 @@ The data should be immutable. If you return mutable objects that you will be edi
|
|||
|
||||
To add custom, diffable models, you need to conform to the `IGListDiffable` protocol and implement `diffIdentifier()` and `isEqual(toDiffableObject:)`.
|
||||
|
||||
> **Note:** an object's `diffIdentifier()` should never change. If an object mutates it's `diffIdentifer()` the behavior of IGListKit is undefined (and almost assuredly undesirable).
|
||||
|
||||
For an example, consider the following model:
|
||||
|
||||
```swift
|
||||
|
|
|
|||
Loading…
Reference in a new issue