Objective-C validation toolkit with chaining syntax
- MultiRule validation support
- Chaining syntax support
zRule *rule = [zRuleWithComparator ruleWithComparator:^BOOL(id data){
return [data isKindOfClass:[NSString class]] && [@"i am the correct string" isEqualToString:data];
}]
if([rule validate:@"random string"]){
// we cool ;p
}else{
// something happened.
} zRule *rule = [zComplexRule ruleLogicAND].is(^BOOL(id data){
return [data isKindOfClass:[NSString class]];
}).is(^BOOL(id data){
return [data length] > 3;
}).is(^BOOL(id data){
return [data length] < 5;
});
NSAssert([rule validate:@"abcd"], @"oh shit".); // we cool here ;p
NSAssert([rule validate:@"abc"], @"oh shit."); // oh shit.
NSAssert([rule validate:@"abcde"], @"oh shit."); // oh shit.Installation with Cocoapods
Any problems? please post issues here.
- FoundationKit support.
- UIKit support.
- Configuration file support.
- ...
All source code is licensed under the MIT License.