SecureMappingKit 可以实现 JSON 数据和 Model 类之间安全的映射。
转换器包括:
NSNumberTransformer,
NSBooleanNumberTransformer, to be sure to have a NSNumber of a boolean
NSStringTransformer,
NSURLTransformer,
NSArrayTransformer,
NSDateTransformer,
NSDecimalTransformer
使用:
- (id)objectForKey:(id)aKey expectedClass:(Class)expectedClass; - (id)objectForKey:(id)aKey expectedClass:(Class)expectedClass withTransformerClass:(Class)transformerClass; - (id)objectForKey:(id)aKey withTransformerBlock:(JMOTransformerBlock)transformerBlock; - (NSNumber *)numberForKey:(id)aKey; - (NSNumber *)boolNumberForKey:(id)aKey; - (NSDecimalNumber *)decimalNumberForKey:(id)aKey; - (NSString *)stringForKey:(id)aKey; - (NSURL *)urlForKey:(id)aKey; - (NSArray *)arrayForKey:(id)aKey; - (NSDate *)dateForKey:(id)aKey usingDateFormat:(NSString *)dateFormat;