Latest 0.0.2
Homepage https://github.com/Hearsayer/ZJModel
License MIT
Platforms ios 7.0, requires ARC
Authors

一个打印Json字典中模型属性的小工具

字典转属性输出

如果有以下一个字典

NSDictionary *dict = @{
@"name" : @"Jack",
@"icon" : @"lufy.png",
@"age"  : @20,
@"money": @100.9,
@"sex"  : @(1),
@"gay"  : @"true",
@"books": @[@"book1", @"book2"],
};

调用ZJModel方法

// 调用ZJModel方法
[ZJModel modelWithDictionary:dict modelName:@"Model"];

最后控制台打印如下

@interface Model :NSObject
@property (nonatomic, strong) NSNumber *money;
@property (nonatomic,   copy) NSString *gay;
@property (nonatomic, strong) NSArray *books;
@property (nonatomic, strong) NSNumber *age;
@property (nonatomic, strong) NSNumber *sex;
@property (nonatomic,   copy) NSString *name;
@property (nonatomic,   copy) NSString *icon;
@end

Latest podspec

{
    "name": "ZJModel",
    "version": "0.0.2",
    "summary": "u4e00u4e2au6253u5370Jsonu5b57u5178u4e2du6a21u578bu5c5eu6027u7684u5c0fu5de5u5177",
    "homepage": "https://github.com/Hearsayer/ZJModel",
    "license": "MIT",
    "authors": {
        "Hearsayer": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Hearsayer/ZJModel.git",
        "tag": "0.0.2"
    },
    "source_files": "ZJModel/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This