我想使用 Mantle 框架 ( https://github.com/github/Mantle ) 为我的类使用 struct 属性支持 NSCoding:
typedef struct {
int x;
int y;
} MPoint;
typedef struct {
MPoint min;
MPoint max;
} MRect;
@interface MObject : MTLModel
@property (assign, nonatomic) MRect rect;
@end
@implementation MObject
@end
但是当我试图[NSKeyedArchiver archiveRootObject:obj toFile:@"file"];
让它在MTLModel+NSCoding.m中崩溃的时候,- (void)encodeWithCoder:(NSCoder *)coder
就上线了
case MTLModelEncodingBehaviorUnconditional:
[coder encodeObject:value forKey:key];
Mantle 是否支持 c-struct 编码(以及解码)或者我需要为此类类自定义实现 NSCoding 协议?