Matle是Cocoa和CocoaTouch的模型框架,你可以通过它为你的Cocoa和CocoaTouch写简单的模型层。
示例代码:
@iterface XYUser : MTLModel@property (readoly, oatomic, copy) NSStrig *ame;@property (readoly, oatomic, strog) NSDate *createdAt;@property (readoly, oatomic, assig, getter = isMeUser) BOOL meUser;@property (readoly, oatomic, strog) XYHelper *helper;@ed@implemetatio XYUser+ (NSDictioary *)JSONKeyPathsByPropertyKey { retur @{ @"ame": @"ame", @"createdAt": @"created_at" };}- (istacetype)iitWithDictioary:(NSDictioary *)dictioaryValue error:(NSError **)error { self = [super iitWithDictioary:dictioaryValue error:error]; if (self == il) retur il; _helper = [XYHelper helperWithName:self.ame createdAt:self.createdAt]; retur self;}@ed
评论