Skip navigation.
 
mlRe: Leopard Properties and 'non-nil' declaration
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/>

Related mailsAuthorDate
mlLeopard Properties and NSMutable Array Jonathan Jan 6, 02:41
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 6, 02:53
mlRe: Leopard Properties and NSMutable Array Jonathan Dann Jan 6, 03:13
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 6, 03:16
mlRe: Leopard Properties and NSMutable Array André Pang Jan 6, 04:10
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 6, 04:43
mlRe: Leopard Properties and NSMutable Array Scott Stevenson Jan 6, 04:49
mlLeopard Properties and 'non-nil' declaration André Pang Jan 6, 05:07
mlRe: Leopard Properties and 'non-nil' declaration Scott Stevenson Jan 6, 07:18
mlRe: Leopard Properties and 'non-nil' declaration André Pang Jan 6, 07:28
mlRe: Leopard Properties and 'non-nil' declaration Scott Anguish Jan 6, 08:33
mlRe: Leopard Properties and NSMutable Array Jonathan Dann Jan 6, 12:51
mlRe: Leopard Properties and NSMutable Array Jonathan Dann Jan 6, 15:55
mlRe: Leopard Properties and NSMutable Array Jonathan Dann Jan 6, 18:57
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 6, 20:05
mlRe: Leopard Properties and NSMutable Array mmalc crawford Jan 6, 20:19
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 6, 20:20
mlRe: Leopard Properties and NSMutable Array Jonathan Dann Jan 6, 20:32
mlRe: Leopard Properties and NSMutable Array Jim Correia Jan 6, 20:32
mlRe: Leopard Properties and NSMutable Array Bill Bumgarner Jan 13, 20:13