Skip to content

Provides an opportunity of validating converted model objects for MJExtension.

License

Notifications You must be signed in to change notification settings

ElfSundae/MJExtensionValidation

Repository files navigation

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.

About

Provides an opportunity of validating converted model objects for MJExtension.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published