File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -295,4 +295,32 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
295
295
}
296
296
}
297
297
298
+ #pragma mark - NSObject -
299
+
300
+ - (BOOL )isEqual : (id )object
301
+ {
302
+ if (self == object) return YES ;
303
+ if (![object isMemberOfClass: [self class ]]) return NO ;
304
+
305
+ for (NSString *key in self.propertyKeys ) {
306
+ id selfValue = [self valueForKey: key];
307
+ id objectValue = [object valueForKey: key];
308
+
309
+ BOOL valuesEqual = ((selfValue == nil && objectValue == nil ) || [selfValue isEqual: objectValue]);
310
+ if (!valuesEqual) return NO ;
311
+ }
312
+
313
+ return YES ;
314
+ }
315
+
316
+ - (NSUInteger )hash {
317
+ NSUInteger value = 0 ;
318
+
319
+ for (NSString *key in self.propertyKeys ) {
320
+ value ^= [[self valueForKey: key] hash ];
321
+ }
322
+
323
+ return value;
324
+ }
325
+
298
326
@end
You can’t perform that action at this time.
0 commit comments