• 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
Is it possible to traverse dictionaries and arrays using KVC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it possible to traverse dictionaries and arrays using KVC?


  • Subject: Is it possible to traverse dictionaries and arrays using KVC?
  • From: Tito Ciuro <email@hidden>
  • Date: Tue, 16 Aug 2011 11:03:30 -0700

Hello,

In KVC, the setValue:forKeyPath: method is super handy to set values in deep hierarchies. I was wondering if it would be possible to access array elements using KVC. I haven't seen any reference about it in the docs, so I was wondering if it's at all possible. Example:

NSDictionary (characters)
 |-- NSDictionary (friends)
        |-- NSMutableArray (jim, sarah, peter)

Using a key path such as characters.friends.usa[2] (or something similar), could I access peter?

Traversing it manually isn't a problem, but if KVC can do it for me, then great!

Thanks,

-- Tito
_______________________________________________

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: Is it possible to traverse dictionaries and arrays using KVC?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: How can I prevent drag-and-drop initiation in an NSTextField
  • Next by Date: Core Data to many relationship deletion causing exception
  • Previous by thread: Re: side by side xcode, open scripts
  • Next by thread: Re: Is it possible to traverse dictionaries and arrays using KVC?
  • Index(es):
    • Date
    • Thread