FROM : André Pang
DATE : Sun Jan 06 07:28:37 2008
On 06/01/2008, at 5:18 PM, Scott Stevenson wrote:
>> Right now I'm resorting to writing my own setters for properties
>> that I want to be non-nil, which is OK, but hey, the less work I
>> have to do, the better :)
>
> Key-Value Validation may help:
> <http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html
> >
I looked at that. However, that documentation says that Key-Value
Validation methods are not called when a property is set:
"Key-value coding does not perform validation automatically. It is,
in general, your application’s responsibility to invoke the validation
methods"
and:
"Warning: An implementation of -set<Key>: for a property should
never call the validation methods."
It feels like Key-Value Validation is designed for higher-level
purposes than making sure an object is non-nil in a setter. From what
I've read, it seems like the setter methods are the correct place to
check for that.
--
% Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>
DATE : Sun Jan 06 07:28:37 2008
On 06/01/2008, at 5:18 PM, Scott Stevenson wrote:
>> Right now I'm resorting to writing my own setters for properties
>> that I want to be non-nil, which is OK, but hey, the less work I
>> have to do, the better :)
>
> Key-Value Validation may help:
> <http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html
> >
I looked at that. However, that documentation says that Key-Value
Validation methods are not called when a property is set:
"Key-value coding does not perform validation automatically. It is,
in general, your application’s responsibility to invoke the validation
methods"
and:
"Warning: An implementation of -set<Key>: for a property should
never call the validation methods."
It feels like Key-Value Validation is designed for higher-level
purposes than making sure an object is non-nil in a setter. From what
I've read, it seems like the setter methods are the correct place to
check for that.
--
% Andre Pang : trust.in.love.to.save <http://www.algorithm.com.au/>






Cocoa mail archive

