• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: noob questions regarding KVC accessors for a mutable array property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: noob questions regarding KVC accessors for a mutable array property
      • From: Stuart Malin <email@hidden>
References: 
 >noob questions regarding KVC accessors for a mutable array property (From: Stuart Malin <email@hidden>)

  • Prev by Date: Re: noob questions regarding KVC accessors for a mutable array property
  • Next by Date: Re: subclassing CAAnimation
  • Previous by thread: Re: noob questions regarding KVC accessors for a mutable array property
  • Next by thread: Re: noob questions regarding KVC accessors for a mutable array property
  • Index(es):
    • Date
    • Thread