MJExtensionValidation 1.1.0

MJExtensionValidation 1.1.0

Maintained by Elf Sundae.



  • By
  • Elf Sundae

MJExtensionValidation

Build status CocoaPods Platforms

MJExtensionValidation provides an opportunity of validating converted model objects for MJExtension (A fast, convenient and nonintrusive conversion framework between JSON and model).

MJExtension 的 JSON-to-Model 转换增加校验接口。

Installation

pod 'MJExtensionValidation'

Usage

Implement +mj_validateConvertedObject:withKeyValues: method for your model to validate the converted object:

#import <MJExtensionValidation/MJExtensionValidation.h>

@implementation User

+ (BOOL)mj_validateConvertedObject:(User *)user withKeyValues:(id)keyValues
{
    return user.ID.length > 0;
}

@end

Then the JSON-to-model converting methods such as +mj_objectWithKeyValues: will return nil if the converted object could not pass the validation.

License

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