Re: Correct way to implement validateValue:?
Re: Correct way to implement validateValue:?
- Subject: Re: Correct way to implement validateValue:?
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 25 Jun 2005 02:44:37 -0700
On Jun 25, 2005, at 2:22 AM, Keith Blount wrote:
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
That is the correct signature. In your original post you wrote that
you had implemented:
- (BOOL)validateProperties:(id *)ioValue
forKeyPath:(NSString *)inKeyPath error:(NSError
**)outError
and
- (BOOL)validateProperties:(id *)ioValue
forKey:(NSString *)key error:(NSError **)outError
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?
If you're binding to key-value pairs *within* the dictionary, then
when you modify a value you're not changing the dictionary itself.
The same dictionary instance is used throughout. Therefore the
validation method for that instance is not invoked.
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?)
Given the situation, this is probably best done at the controller
level...
mmalc
_______________________________________________
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