ObjectEquality 0.0.3

ObjectEquality 0.0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2015

Maintained by Tony Li.



Override isEqual: and hash methods with one line of code:

@interface Person : NSObject

@property (nonatomic, strong) NSString *firstName;
@property (nonatomic, strong) NSString *lastName;

@end

@implementation Person

equality_properties(Person, firstName, lastName);

@end

The equality_properties macro will generate isEqual: and hash methods, and also add an isEqualToXxx: (isEqualToPerson: in this case) method.

Equality

  • Objects are not equal if they are not same class.
  • Objects are equal if values of specified properties are all equal.

Hash

The hash algorithm is from Mike Ash's blog post.

License

ObjectEquality is available under the MIT license. See the LICENSE file for more info.