They should conform to theNSCoding
protocol.- (void) encodeWithCoder: (NSCoder *) coder { [coder encodeInt: x forKey: @"x"]; [coder encodeInt: y forKey: @"y"]; [coder encodeObject: color1 forKey: @"color1"]; [coder encodeObject: color2 forKey: @"color2"]; [coder encodeInt: direction forKey: @"direction"]; } // encodeWithCoder - (id) initWithCoder: (NSCoder *) coder { if (self = [super init]) { x = [coder decodeIntForKey: @"x"]; y = [coder decodeIntForKey: @"y"]; color1 = [coder decodeObjectForKey: @"color1"]; color2 = [coder decodeObjectForKey: @"color2"]; direction = [coder decodeIntForKey: @"direction"]; } return (self); } // initWithCoder