mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-22 16:58:23 +00:00
Typo in the comparison
Summary: Issue fixed: # - [ ] All tests pass. Demo project builds and runs. - [ ] I added tests, an experiment, or detailed why my change isn't tested. - [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/716 Reviewed By: rnystrom Differential Revision: D5003529 Pulled By: jessesquires fbshipit-source-id: e7a0bdcff962f94c33f24f27e1fc9c0a3ed8dbfb
This commit is contained in:
parent
a4e5ad862e
commit
034f162d6d
1 changed files with 1 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ Even though `IGListKit` uses the method `-isEqualToDiffableObject:`, the concept
|
|||
- If you override `-isEqual:` you **must** override `-hash`. Check out this [article by Mike Ash](https://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html) for details.
|
||||
- Always compare the pointer first. This saves a lot of wasteful `objc_msgSend(...)` calls and value comparisons if checking the same instance.
|
||||
- When comparing object values, always check for `nil` before `-isEqual:`. For example, `[nil isEqual:nil]` unintuitively returns `NO`. Instead, do `left == right || [left isEqual:right]`.
|
||||
- Always compare the **cheapest values first**. For example, doing `[self.array isEqual:other.array] && self.intVal == other.array` is extremely wasteful if the `intVal` values are different. Use lazy evaluation!
|
||||
- Always compare the **cheapest values first**. For example, doing `[self.array isEqual:other.array] && self.intVal == other.intVal` is extremely wasteful if the `intVal` values are different. Use lazy evaluation!
|
||||
|
||||
As an example, if I had a `User` model with the following interface:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue