Feature request - objectWith... autonaming

I absolutely LOVE the objectWith... autogeneration added in 1.6. Makes my life so much easier.

What would make this even better would be to take the last word of the class and put it in there instead.

So for example:

Currently, would autogenerate:

@implementation KPStringValidator

-(id)initWithString:(NSString *)aString {

    self = [super init];

    if (self) {

        string = aString;

    }

    return self;

}

+(id)objectWithString:(NSString *)aString {

    return [[KPStringValidator alloc] initWithString:aString];

}



With my suggestion:


@implementation KPStringValidator

-(id)initWithString:(NSString *)aString {

    self = [super init];

    if (self) {

        string = aString;

    }

    return self;

}

+(id)validatorWithString:(NSString *)aString {

    return [[KPStringValidator alloc] initWithString:aString];

}



This is a common enough pattern in my code to work 99% of the time and it makes the code so much more semantic instead of having objectWith... scattered throughout.

Thanks for the amazing product!

J
2 comments
Comment actions Permalink

Damn. Sorry, I was going to put this in YouTrack and thought feature requests weren't allowed.

Just read the notice on the main board. I'm transferring this to YouTrack now.

0

Please sign in to leave a comment.