Accessorizer  generates code for key validation


NSString *title;

Animal *animal;

int count;


// DECLARATION //

- (BOOL)validateTitle:(id *)ioValue error:(NSError **)outError;

- (BOOL)validateAnimal:(id *)ioValue error:(NSError **)outError;

- (BOOL)validateCount:(id *)ioValue error:(NSError **)outError;



// INVOCATION //

NSError *outError = nil;

NSString *aTitle;

aTitle = [[[NSString alloc] init] autorelease];




if ([<receiver> validateTitle:&aTitle error:&outError]) {

    [<receiver> setValue:aTitle forKey:@"title"];

}

else {

// inform the user that the value is invalid

}


[aTitle release];Animal *anAnimal;

anAnimal = [[[Animal alloc] init] autorelease];


if ([<receiver> validateAnimal:&anAnimal error:&outError]) {

    [<receiver> setValue:anAnimal forKey:@"animal"];

}

else {

    // inform the user that the value is invalid

}


[anAnimal release];



// IMPLEMENTATION //

- (BOOL)validateTitle:(id *)ioValue error:(NSError **)outError

{

    if (*ioValue == nil) {

        return YES;

    }

        // implementation specific code

    return YES;

}


- (BOOL)validateAnimal:(id *)ioValue error:(NSError **)outError

{

    if (*ioValue == nil) {

        return YES;

    }

    // implementation specific code

    return YES;

}


- (BOOL)validateCount:(id *)ioValue error:(NSError **)outError

{

    if (*ioValue == nil) {

        // trap this in setNilValueForKey

        // alternative might be to create new NSNumber with value 0 here

        return YES;

    }

    // implementation specific code

    return YES;

}

Key Validation

What developers 
are saying ...testimonials.htmltestimonials.htmlshapeimage_1_link_0shapeimage_1_link_1
Videos & TutorialsaccessorizerVideos.htmlaccessorizerVideos.htmlshapeimage_3_link_0
Homeaccessorizer.htmlaccessorizer.htmlshapeimage_4_link_0
© 2002 - 2009 Kevin Callahanhttp://www.kevincallahan.orgshapeimage_5_link_0

KVO

Initialization MethodsinitMethods.htmlinitMethods.htmlshapeimage_6_link_0

Features

Indexed AccessorsindexedAccessors.htmlindexedAccessors.htmlshapeimage_7_link_0
BUYhttp://store.eSellerate.net/s.aspx?s=STR5524388698

only $15