LookinConnectionAttachment.m 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // LookinConnectionAttachment.m
  3. // Lookin
  4. //
  5. // Created by Li Kai on 2019/2/15.
  6. // https://lookin.work
  7. //
  8. #import "LookinConnectionAttachment.h"
  9. #import "LookinDefines.h"
  10. #import "NSObject+Lookin.h"
  11. static NSString * const Key_Data = @"0";
  12. static NSString * const Key_DataType = @"1";
  13. @interface LookinConnectionAttachment ()
  14. @end
  15. @implementation LookinConnectionAttachment
  16. - (instancetype)init {
  17. if (self = [super init]) {
  18. }
  19. return self;
  20. }
  21. - (void)encodeWithCoder:(NSCoder *)aCoder {
  22. [aCoder encodeObject:[self.data lookin_encodedObjectWithType:self.dataType] forKey:Key_Data];
  23. [aCoder encodeInteger:self.dataType forKey:Key_DataType];
  24. }
  25. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  26. if (self = [super init]) {
  27. self.dataType = [aDecoder decodeIntegerForKey:Key_DataType];
  28. self.data = [[aDecoder decodeObjectForKey:Key_Data] lookin_decodedObjectWithType:self.dataType];
  29. }
  30. return self;
  31. }
  32. + (BOOL)supportsSecureCoding {
  33. return YES;
  34. }
  35. @end