• 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: KVC and KVO for arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVC and KVO for arrays


  • Subject: Re: KVC and KVO for arrays
  • From: Adam P Jenkins <email@hidden>
  • Date: Wed, 13 Feb 2008 16:57:01 -0500


On Feb 13, 2008, at 4:30 PM, mmalc crawford wrote:
It's not clear why you're making things more complicated than necessary.
Just uses indexed accessors.


The above will not work unless you're using garbage collection...


I don't think my example is complicated at all. In fact leaving out the indexed accessors makes my Party class trivially simple. I do agree that in a production app I'd probably just bite the bullet and add indexed accessors. I'm just demonstrating that you don't need to implement them, because the array proxy that mutableArrayValueForKey: returns will do the work for you if you follow the right conventions. It is a little fragile, because if you later added accessor methods to the Party class for the attendees property, it would revert to copying the array on each modification.

As for your GC comment, you're probably right that my code leaks without GC turned on. Since I got Leopard, I've gotten into the habit of just enabling GC for all my projects, and haven't looked back. I do realize this makes my programs unable to run on previous versions of OSX, and that if I was writing commercial Mac software I might not make that choice. But I enjoy programming much more when the language I'm using has GC, and since my Mac programming is all just hobby stuff I don't mind if it won't run on pre-Leopard systems.

Adam
_______________________________________________

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


References: 
 >KVC and KVO for arrays (From: Hans van der Meer <email@hidden>)
 >Re: KVC and KVO for arrays (From: Adam P Jenkins <email@hidden>)
 >Re: KVC and KVO for arrays (From: mmalc crawford <email@hidden>)
 >Re: KVC and KVO for arrays (From: Adam P Jenkins <email@hidden>)
 >Re: KVC and KVO for arrays (From: mmalc crawford <email@hidden>)
 >Re: KVC and KVO for arrays (From: Adam P Jenkins <email@hidden>)
 >Re: KVC and KVO for arrays (From: Jens Alfke <email@hidden>)
 >Re: KVC and KVO for arrays (From: Adam P Jenkins <email@hidden>)
 >Re: KVC and KVO for arrays (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Uncaught exceptions thrown by Cocoa documented anywhere?
  • Next by Date: Re: Do i need custom views created programatically
  • Previous by thread: Re: KVC and KVO for arrays
  • Next by thread: Re: KVC and KVO for arrays
  • Index(es):
    • Date
    • Thread