LookinAttributeModification.m 1008 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // LookinAttributeModification.m
  3. // Lookin
  4. //
  5. // Created by Li Kai on 2018/11/20.
  6. // https://lookin.work
  7. //
  8. #import "LookinAttributeModification.h"
  9. @implementation LookinAttributeModification
  10. - (void)encodeWithCoder:(NSCoder *)aCoder {
  11. [aCoder encodeObject:@(self.targetOid) forKey:@"targetOid"];
  12. [aCoder encodeObject:NSStringFromSelector(self.setterSelector) forKey:@"setterSelector"];
  13. [aCoder encodeInteger:self.attrType forKey:@"attrType"];
  14. [aCoder encodeObject:self.value forKey:@"value"];
  15. }
  16. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  17. if (self = [super init]) {
  18. self.targetOid = [[aDecoder decodeObjectForKey:@"targetOid"] unsignedLongValue];
  19. self.setterSelector = NSSelectorFromString([aDecoder decodeObjectForKey:@"setterSelector"]);
  20. self.attrType = [aDecoder decodeIntegerForKey:@"attrType"];
  21. self.value = [aDecoder decodeObjectForKey:@"value"];
  22. }
  23. return self;
  24. }
  25. + (BOOL)supportsSecureCoding {
  26. return YES;
  27. }
  28. @end