I’d like the check wether a dictionaries content has changed without going through all keys/values.
Background is that my app is frequently receiving NSUserDefaultsDidChangeNotification due to some additional libraries which access the NSUserDefaults. My own defaults are stored in one dictionary within the defaults.
On started up values from userdefaults are read but not locally stored so I can’t compare them.
What I was thinking about is generating a hash value over all values on startup and store that value somewhere and every time I receive a notification I generate the hash value again and compare it with the one stored before distributing the notification internally.
But there might be an easier way?!
That sounds like it would be the simplest way. A longer way around would be to create an
NSMutableSetof the original values, then anNSMutableSetof the changed values.NSSet‘sminusSet:method would then give you the deltas. But that sounds like a lot more heavy lifting than just enumerating the dictionary…