I've read that -hash does not return the same value on different architectures. However, I don't currently see this in the docs.
Is there a better way to store NSView's in a dictionary without subclassing?
I've read that -hash does not return the same value on different architectures. However, I don't currently see this in the docs.
Is there a better way to store NSView's in a dictionary without subclassing?
You might be confused as to what hash means in this context. Hash is just a number which Cocoa collection classes use internally to improve performance. NSObject implements this method, so you don't have to ever override it unless a better, more meaningful hash algorithm results in better performance while comparing/searching objects in an array or a dictionary.
Since no objects should cache their hash values on disk, the comment just implies you should not rely on the concrete hash values returned by Apple's classes. It is considered a minor implementation detail.
NSDictionary retains its values but copies the keys. So you don't have to do anything to keep your views in a dictionary as values, but if you want to use the views as keys, you have to implement -copyWithZone: method.
Read more in Apple's documentation.