views:

42

answers:

2

In Objective-C properties you can set alternative names fpr the accessors.

@property(setter=nameWrite:,getter=nameRead,copy) NSString *name;

I am thinking real hard but I don't know any situation I would ever do that. It is not KVC standard and I see no advantage at all. What is the use of it?

A: 

It's seen all the time when you have a BOOL.

Ex:

@property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled;
Kurbz
+4  A: 

Mostly, it is used for BOOL properties:

@property(getter=isHidden) BOOL hidden;
@property(readonly, getter=isFinishedLaunching) BOOL finishedLaunching;

But, yeah, beyond that, it isn't used often at all (nor should it be).

bbum
Worth noting that this usage *is* KVC-compliant, as KVC will look for `isFoo` as well as `foo` for `BOOL` properties.
Peter Hosey