[WP/160] How to store custom class using CoreData
- (id)initWithCoder:(NSCoder *)coder { | |
if ((self = [super init])) { | |
thumbnailExists = [coder decodeBoolForKey:@"thumbnailExists"]; | |
totalBytes = [coder decodeInt64ForKey:@"totalBytes"]; | |
lastModifiedDate = [coder decodeObjectForKey:@"lastModifiedDate"]; | |
path = [[coder decodeObjectForKey:@"path"] retain]; | |
// ... | |
} | |
return self; | |
} | |
- (void)encodeWithCoder:(NSCoder *)coder { | |
[coder encodeBool:thumbnailExists forKey:@"thumbnailExists"]; | |
[coder encodeInt64:totalBytes forKey:@"totalBytes"]; | |
[coder encodeObject:lastModifiedDate forKey:@"lastModifiedDate"]; | |
[coder encodeObject:path forKey:@"path"]; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment