cdts/xdts-ios 3/TreeHole/Code/Gategory/BRPickerView/StringPickerView/BRResultModel.m
2023-07-27 09:20:00 +08:00

42 lines
1001 B
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// BRResultModel.m
// BRPickerViewDemo
//
// Created by renbo on 2019/10/2.
// Copyright © 2019 irenb. All rights reserved.
//
// 最新代码下载地址https://github.com/91renb/BRPickerView
#import "BRResultModel.h"
@implementation BRResultModel
/// 判断两个对象是否相等
/// @param object 目标对象
- (BOOL)isEqual:(id)object {
// 1.对象的地址相同
if (self == object) {
return YES;
}
if (![object isKindOfClass:[BRResultModel class]]) {
return NO;
}
BRResultModel *model = (BRResultModel *)object;
if (!model) {
return NO;
}
// 2.对象的类型相同,且对象的各个属性相等
BOOL isSameKey = (!self.key && !model.key) || [self.key isEqualToString:model.key];
BOOL isSameValue = (!self.value && !model.value) || [self.value isEqualToString:model.value];
return isSameKey && isSameValue;
}
- (NSUInteger)hash {
return [self.key hash] ^ [self.value hash];
}
@end