Skip to content

Codelem/SIModel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SIModel

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.

About

将JSON快速转换模型

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Objective-C 98.4%
  • Ruby 1.6%