Latest 1.1
Homepage https://github.com/silence0201/SIModel
License MIT
Platforms ios 7.0, requires ARC
Authors

Language
License
将JSON快速转换模型

使用说明

安装

手工导入

将项目目录下的SIModel导入项目中

使用

  1. 导入头文件

    #import "NSObject+SIModel.h"
  2. 建立模型对象,进行属性定义(仅支持默认get和set方法)
  3. 如果Array中包含自定义Class,需要实现:

    + (NSDictionary <NSString *,Class> *)si_clazzInArray{
        return @{@"users":[User class]} ;
    }
  4. 如何属性名和JSON或字典中的key不相同,需要实现:

    + (NSDictionary <NSString *,NSString *> *)si_replaceKeyFromPropertyName{
        return @{
            @"ID" : @"id" ,
                @"desc" : @"desciption"
                } ;
    }
  5. 过程处理

    + (void)si_beginObjectToModel:(id)obj{
        NSLog(@"开始转换:%@",obj) ;
    }
    + (void)si_endObjectToModel:(id)model{
        NSLog(@"结束转换:%@",model) ;
    }
  6. 快速归档

    @interface Members : NSObject<NSCoding>
    
    // 实现中添加
    SIModelCodingImplementation
  7. 更多请查看NSObject+SIModel.h说明

SIModel

SIModel is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SIModel",
    "version": "1.1",
    "summary": "JSON To Model",
    "description": "A Way  JSON To Model",
    "homepage": "https://github.com/silence0201/SIModel",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Silence": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/silence0201/SIModel.git",
        "tag": "1.1"
    },
    "source_files": [
        "SIModel",
        "SIModel/**/*.{h,m}"
    ],
    "exclude_files": "SIModel/Exclude",
    "public_header_files": "SIModel/**/*.h",
    "requires_arc": true
}

Pin It on Pinterest

Share This