12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifdef SHOULD_COMPILE_LOOKIN_SERVER
- //
- // LookinAttributesGroup.m
- // Lookin
- //
- // Created by Li Kai on 2018/11/19.
- // https://lookin.work
- //
- #import "LookinAttributesGroup.h"
- #import "LookinAttribute.h"
- #import "LookinAttributesSection.h"
- #import "NSArray+Lookin.h"
- @implementation LookinAttributesGroup
- #pragma mark - <NSCopying>
- - (id)copyWithZone:(NSZone *)zone {
- LookinAttributesGroup *newGroup = [[LookinAttributesGroup allocWithZone:zone] init];
- newGroup.identifier = self.identifier;
- newGroup.attrSections = [self.attrSections lookin_map:^id(NSUInteger idx, LookinAttributesSection *value) {
- return value.copy;
- }];
- return newGroup;
- }
- #pragma mark - <NSCoding>
- - (void)encodeWithCoder:(NSCoder *)aCoder {
- [aCoder encodeObject:self.identifier forKey:@"identifier"];
- [aCoder encodeObject:self.attrSections forKey:@"attrSections"];
- }
- - (instancetype)initWithCoder:(NSCoder *)aDecoder {
- if (self = [super init]) {
- self.identifier = [aDecoder decodeObjectForKey:@"identifier"];
- self.attrSections = [aDecoder decodeObjectForKey:@"attrSections"];
- }
- return self;
- }
- - (NSUInteger)hash {
- return self.identifier.hash;
- }
- - (BOOL)isEqual:(id)object {
- if (self == object) {
- return YES;
- }
- if (![object isKindOfClass:[LookinAttributesGroup class]]) {
- return NO;
- }
- if (self.identifier == ((LookinAttributesGroup *)object).identifier) {
- return YES;
- }
- return NO;
- }
- + (BOOL)supportsSecureCoding {
- return YES;
- }
- @end
- #endif /* SHOULD_COMPILE_LOOKIN_SERVER */
|