KVO/KVC compliance, signature for -validate<Key>: error:
KVO/KVC compliance, signature for -validate<Key>: error:
- Subject: KVO/KVC compliance, signature for -validate<Key>: error:
- From: Don Briggs <email@hidden>
- Date: Thu, 1 Jan 2004 15:45:04 -0800
Hello, all
In (new?) documentation for KVC compliance, I saw at
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/Concepts/Compliant.html#//apple_ref/doc/uid/20002172
" Your class should implement -validate<Key>:error: if validation is
appropriate for the key."
and I'm concerned about the exact signature expected.
In NSKeyValueCoding, I see
- (BOOL) validateValue: (id *) ioValue forKey: (NSString *) key error:
(NSError **) outError
and
- (BOOL) validateValue: (id *) ioValue forKeyPath: (NSString *)
inKeyPath error: (NSError **) outError
Therefore, for an attribute of type NSString with the key @"name", I
INFER that I should provide
-(BOOL) validateName: (NSString*)testName error: (NSError **) outError;
and for an attribute of type NSNumber with the key @"uniqueID" I should
provide
-(BOOL) validateUniqueID: (NSNumber*)testID error: (NSError **)
outError;
Do I infer correctly?
Have I missed more complete documentation?
Next question:
What happens to the instance of NSError?
How is it used?
How would I best intervene with the Controller Layer to, say, display a
sheet with information from the NSError that results when the user
supplies an invalid value?
(Again, have I missed more complete documentation?)
Regards,
Don
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.