Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-18 Thread Andy Lee
On Aug 17, 2011, at 6:14 PM, Jerry Krinock wrote: On 2011 Aug 16, at 16:17, Andy Lee wrote: I haven't tested with bindings, I would test thoroughly, particularly in Lion. See list archives for July 29, thread with subject Lion doesn't like tricky.key.paths in bindings? Thanks, Jerry. In

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-17 Thread Jerry Krinock
On 2011 Aug 16, at 16:17, Andy Lee wrote: I haven't tested with bindings, I would test thoroughly, particularly in Lion. See list archives for July 29, thread with subject Lion doesn't like tricky.key.paths in bindings? ___ Cocoa-dev mailing list

Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Tito Ciuro
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

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Jens Alfke
On Aug 16, 2011, at 11:03 AM, Tito Ciuro wrote: 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 asked this a couple of weeks ago and was told the answer is “no”.

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Tito Ciuro
Hm. I missed that thread. Thanks Jens! -- Tito On Aug 16, 2011, at 12:52 PM, Jens Alfke wrote: On Aug 16, 2011, at 11:03 AM, Tito Ciuro wrote: 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

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Kyle Sluder
On Tue, Aug 16, 2011 at 12:52 PM, Jens Alfke j...@mooseyard.com wrote: On Aug 16, 2011, at 11:03 AM, Tito Ciuro wrote: 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

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Quincey Morris
On Aug 16, 2011, at 13:02 , Kyle Sluder wrote: Either way, I believe you're correct, and there's no way to get at individual indexed members of an ordered collection via -valueForKeyPath:. In the Land of Speculation … I think it's in principle possible to have such a mechanism, though of

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Thorsten Hohage
Hi, On Tue, 16 Aug 2011 11:03:30 -0700, Tito Ciuro tci...@mac.com wrote: 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,

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Thorsten Hohage
Hi, On Tue, 16 Aug 2011 11:03:30 -0700, Tito Ciuro tci...@mac.com wrote: 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,

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Andy Lee
On Aug 16, 2011, at 6:16 PM, Thorsten Hohage wrote: NSArray *keyArray = [key componentsSeparatedByString:@#]; NSString *arrayKey = [keyArray objectAtIndex:0]; NSString *pathKey = [keyArray objectAtIndex:1];

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Andy Lee
This is one of those things that make my brain itch. I had to puzzle over this... On Aug 16, 2011, at 4:18 PM, Quincey Morris wrote: Noting that a key path like someObject.someArrayProperty.count is valid, I think you could envisage key paths of the form someObject.someArrayProperty.@0 and

Re: Is it possible to traverse dictionaries and arrays using KVC?

2011-08-16 Thread Andy Lee
Here's a .m file that I claim you can drop into your project and you'll get the feature I described in my previous email. I wouldn't be surprised at all if I'm overlooking a fundamental flaw, so please let me know if you find one. I haven't tested with bindings, just with NSLog plus