Ruby on Rails Validations in Objective-C

I’ve uploaded my MMValidation project to Github. It’s an easy way to get Rails-style validations on any subclass of NSObject.

You declare validations like this:

+(void)initialize {
    [Person validatesPresenceOf:@"firstName"];
    [Person validatesPresenceOf:@"lastName"];
}

And check them like this:

if ([myObject valid]) {
    // yay! proceed as planned
} else {
    // handle the validation errors
}

Click here to get it. Hope you enjoy!

2 Comments

  1. Adrian says:

    nice and easy. good work

  2. Jerry Cheung says:

    nice! that looks really awesome

Leave a Reply