From 85afdfa54b22eb7c4bc3d57c7310c1c3a6ebf8ed Mon Sep 17 00:00:00 2001 From: Clay Reimann Date: Thu, 3 Aug 2017 06:04:26 -0700 Subject: [PATCH] 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 --- Guides/Getting Started.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Guides/Getting Started.md b/Guides/Getting Started.md index f8fc1757..cc841f9e 100644 --- a/Guides/Getting Started.md +++ b/Guides/Getting Started.md @@ -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