CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by EricShi.
Few words to make your NSCoding protocol automatic.
Copy two files to you project, and #import "NSObject+NSCoding.h"
.
CocoaPods
is support now.
self
is a subclass of Parent
Parent:
#pragma mark - NSCoding
- (void)encodeWithCoder:(NSCoder *)encoder
{
[self encodeAutoWithCoder:encoder class:[Parent class]];
}
- (id)initWithCoder:(NSCoder *)decoder
{
if (self = [super init]) {
[self decodeAutoWithAutoCoder:decoder class:[Parent class]];
}
return self;
}
Children:
#pragma mark - NSCoding
- (void)encodeWithCoder:(NSCoder *)encoder
{
[super encodeWithCoder:encoder];
[self encodeAutoWithCoder:encoder];
}
- (id)initWithCoder:(NSCoder *)decoder
{
if (self = [super initWithCoder:decoder]) {
[self decodeAutoWithAutoCoder:decoder];
}
return self;
}
#pragma mark - NSCoding
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[self encodeAutoWithCoder:aCoder];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super initWithCoder:aDecoder]) {
[self decodeAutoWithAutoCoder:aDecoder];
}
return self;
}