NSObject+Property.h 786 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // NSObject+Property.h
  3. // RuntimeDemo
  4. //
  5. // Created by LeeJay on 16/8/9.
  6. // Copyright © 2016年 LeeJay. All rights reserved.
  7. // 代码下载地址https://github.com/leejayID/Linkage
  8. #import <Foundation/Foundation.h>
  9. @protocol KeyValue <NSObject>
  10. @optional
  11. /**
  12. * 数组中需要转换的模型类
  13. *
  14. * @return 字典中的key是数组属性名,value是数组中存放模型的Class(Class类型或者NSString类型)
  15. */
  16. + (NSDictionary *)objectClassInArray;
  17. /**
  18. * 将属性名换为其他key去字典中取值
  19. *
  20. * @return 字典中的key是属性名,value是从字典中取值用的key
  21. */
  22. + (NSDictionary *)replacedKeyFromPropertyName;
  23. @end
  24. @interface NSObject (Property) <KeyValue>
  25. + (instancetype)objectWithDictionary:(NSDictionary *)dictionary;
  26. @end