AQSDictionarySerialization 0.1.3

AQSDictionarySerialization 0.1.3

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年1月

kaiinui 维护。



  • 作者
  • kaiinui

[iOS] 字典序列化对象协议

@interface Book : NSObject <AQSDictionarySerialization>

@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *authorName;
@property (nonatomic, copy) NSNumber *isPublished;

@end

@implementaion Book

+ (NSDictionary *)aqs_keyPathsByPropertyKey {
    return @{
        @"title": @"title",
        @"authorName": @"author_name",
        @"isPublished": @"is_published"
    };
}

@end

然后

[[AQSDictionarySerializer serializer] applyPatchForObject:book withDictionary:@{
    @"title": @"Harry Potter",
    @"author_name": @"J. K. Rowling",
    @"is_published": @(NO)
}];

当前限制

  • 您不能使用原始属性,如 BOOLNSInteger 等...
  • 目前您不能使用例如 author.name 这样的 keyPath