Re: Correct way to implement validateValue:?
Re: Correct way to implement validateValue:?
- Subject: Re: Correct way to implement validateValue:?
- From: Keith Blount <email@hidden>
- Date: Sat, 25 Jun 2005 02:22:48 -0700 (PDT)
Many thanks again for taking the time to reply, much
appreciated.
> To clarify: Why are you implementing a method with
> that signature?
> The validation method in the example shows the
> correct method signature:
> -(BOOL)validatePrice:(id *)value error:(NSError
> **)outError
This is what I was trying to follow - as I understand
it, the method signature is value<key>:... In your
example, "price" is an instance variable with
KVC-compliant accessors, which is why the method is
named validatePrice:... And the method is contained
inside the object class with that instance variable.
So, accordingly, in my KBNode class, I have an
instance variable as follows:
NSMutableDictionary *properties;
Thus, isn't the key "properties"? If this is the
instance variable I want to validate (though actually,
I want to validate the actual keys inside the
dictionary, which are bound to my table columns), why
isn't the following the correct signature?
- (BOOL)validateProperties:(id *)ioValue
error:(NSError **)outError
Note I have tried the other variations with forKey:
and forKeyPath: too, and none ever seems to get
called.
Also, is this even the best approach when what I
actually want to do is to check that the file being
renamed doesn't already exist on disk? Shouldn't I
really be doing this in my controller rather than my
model? (But if so, how - validation is at the model
level, isn't it?)
Many thanks again, sorry if I'm missing something
silly here.
All the best,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden