Re: noob questions regarding KVC accessors for a mutable array property
Re: noob questions regarding KVC accessors for a mutable array property
- Subject: Re: noob questions regarding KVC accessors for a mutable array property
- From: Scott Anguish <email@hidden>
- Date: Fri, 27 Jun 2008 00:49:54 -0400
the better way is to implement the indexed accessors described in the
KVC doc.
in fact I know at least one engineer would would like the doc to
specifically say that you should NOT have an accessor that returns an
array like this.
On Jun 26, 2008, at 7:54 PM, Stuart Malin wrote:
Separately, I have an accessor -attendees: of the Party class, which
is currently implemented as:
- (NSArray*) attendees
{
return [NSArray arrayWithArray:attendees]; // "attendees" is an
NSMutableArray, and is an ivar
}
I intentionally do not return the underlying mutable array, because
I don't want other code accessing the content without going through
the accessors.
Is my implementation reasonable? Or are there preferable ways to do
this (such as to return a copy of the mutable array)?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden