Skip to content

Instantly share code, notes, and snippets.

View orj's full-sized avatar

Oliver Jones orj

View GitHub Profile
-(void) encodeWithCoder: (NSCoder*) coder
{
#define X(type, ivar) [coder encode##type:ivar forKey:@#ivar];
#define BOX(type, ivar) [coder encodeObject:([NSValue valueWith##type:ivar]) forKey:@#ivar];
XEncodeIvars
#undef BOX
#undef X
}
-(id) initWithCoder: (NSCoder*) decoder
-(void) encodeWithCoder: (NSCoder*) coder
{
#define X(type, ivar) [coder encode##type:ivar forKey:@#ivar];
XEncodeIvars
#undef X
}
-(id) initWithCoder: (NSCoder*) decoder
{
#define X(type, ivar) ivar = [decoder decode##type##ForKey:@#ivar];