• 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: How to create to-many accessor methods at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to create to-many accessor methods at runtime


  • Subject: Re: How to create to-many accessor methods at runtime
  • From: Steve Weller <email@hidden>
  • Date: Tue, 08 Jul 2008 07:45:02 -0700


On Jul 8, 2008, at 2:28 AM, Mike Abdullah wrote:


On 8 Jul 2008, at 07:10, Steve Weller wrote:

What I am attempting to do is not working. -valueForKey: does not look for methods with -respondsToSelector: to figure out if methods exist sufficient to have KVC. So overriding this has no effect. My only option, it seems, is to use +resolveInstanceMethod and actually create the methods that are needed.

Or, you know, just override -valueForKey: ? NSArray and the other contain classes do just that to get their custom behaviour.


Then I'd need to create an NSArray proxy, probably by subclassing NSArray. This was the way I first thought of and decided not to go that route.

My current thinking is to hard-code -count and -objectForKey (and possibly others) in a helper object, then vend instances of that according to what the array should implement. Each of those objects ultimately gets its data from a single source, so if I change values, all the arrays' customers see the changes. It is likely that I will want KVO compliance one day too and that will not work with the helpers.


Steve Weller email@hidden Technical Writing, Editing, Developer Guides, and a little Cocoa



_______________________________________________

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: How to create to-many accessor methods at runtime
      • From: Mike Abdullah <email@hidden>
References: 
 >re: How to create to-many accessor methods at runtime (From: Ben Trumbull <email@hidden>)
 >Re: How to create to-many accessor methods at runtime (From: Steve Weller <email@hidden>)
 >Re: How to create to-many accessor methods at runtime (From: Steve Weller <email@hidden>)
 >Re: How to create to-many accessor methods at runtime (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: iPhone SDK and sms.db file
  • Next by Date: Re: Proposal for metadata interoperability on OS X
  • Previous by thread: Re: How to create to-many accessor methods at runtime
  • Next by thread: Re: How to create to-many accessor methods at runtime
  • Index(es):
    • Date
    • Thread