Skip to content

Instantly share code, notes, and snippets.

@vendruscolo
Created March 20, 2015 12:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vendruscolo/e0904f9054e0d42f29c2 to your computer and use it in GitHub Desktop.
Save vendruscolo/e0904f9054e0d42f29c2 to your computer and use it in GitHub Desktop.
- (instancetype)initWithCoder:(NSCoder *)coder {
if ((self = [self init])) {
NSDictionary *pointValue = [coder decodeObjectForKey:@"point"];
CGPointMakeWithDictionaryRepresentation((__bridge CFDictionaryRef)pointValue, &_point);
_number = [coder decodeDoubleForKey:@"number"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
CFDictionaryRef pointValue = CGPointCreateDictionaryRepresentation(self.point);
[coder encodeObject:(__bridge NSDictionary *)(pointValue) forKey:@"point"];
[coder encodeDouble:self.number forKey:@"number"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment