What's a good hash function for overwriting NSObject's hash method in your custom classes?
Asked
Active
Viewed 7,723 times
5
-
Why do you think you need to override `hash`? If you do, it is generally because you explicitly want to hash based on whatever data is stored in your object. – bbum May 07 '11 at 01:54
1 Answers
7
Here is a good community wiki page discussing overwriting the functions Implementing -hash / -isEqual: / -isEqualTo...: for Objective-C collections.
And there is an implementation on one of the linked articles Best practices for overriding isEqual: and hash.

Community
- 1
- 1

mistagrooves
- 2,337
- 15
- 16