Cocoa和CocoaTouch的模型框架Mantle.zip
Mantle 是 Cocoa 和 Cocoa Touch 的模型框架,你可以通过它为你的 Cocoa 和 Cocoa Touch 写简单的模型层。示例代码:@interface XYUser : MTLModel @property (readonly, nonatomic, copy) NSString *name; @property (readonly, nonatomic, strong) NSDate *createdAt; @property (readonly, nonatomic, assign, getter = isMeUser) BOOL meUser; @property (readonly, nonatomic, strong) XYHelper *helper; @end @implementation XYUser (NSDictionary *)JSONKeyPathsByPropertyKey { return @{ @"name": @"name", @"createdAt": @"created_at" }; } - (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error { self = [super initWithDictionary:dictionaryValue error:error]; if (self == nil) return nil; _helper = [XYHelper helperWithName:self.name createdAt:self.createdAt]; return self; } @end 标签:Mantle
- 粉丝: 448
- 资源: 1万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助