LookinAttributesSection.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // LookinAttributesSection.m
  3. // Lookin
  4. //
  5. // Created by Li Kai on 2019/3/2.
  6. // https://lookin.work
  7. //
  8. #import "LookinAttributesSection.h"
  9. #import "LookinAttribute.h"
  10. #import "NSArray+Lookin.h"
  11. @implementation LookinAttributesSection
  12. #pragma mark - <NSCopying>
  13. - (id)copyWithZone:(NSZone *)zone {
  14. LookinAttributesSection *newSection = [[LookinAttributesSection allocWithZone:zone] init];
  15. newSection.identifier = self.identifier;
  16. newSection.attributes = [self.attributes lookin_map:^id(NSUInteger idx, LookinAttribute *value) {
  17. return value.copy;
  18. }];
  19. return newSection;
  20. }
  21. #pragma mark - <NSCoding>
  22. - (void)encodeWithCoder:(NSCoder *)aCoder {
  23. [aCoder encodeObject:self.identifier forKey:@"identifier"];
  24. [aCoder encodeObject:self.attributes forKey:@"attributes"];
  25. }
  26. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  27. if (self = [super init]) {
  28. self.identifier = [aDecoder decodeObjectForKey:@"identifier"];
  29. self.attributes = [aDecoder decodeObjectForKey:@"attributes"];
  30. }
  31. return self;
  32. }
  33. + (BOOL)supportsSecureCoding {
  34. return YES;
  35. }
  36. @end