If a class declares an @property that's a reference to one of the collection 
classes (or a mutable variant thereof), such as NSArray, NSDictionary, NSSet, 
etc… can a key path (for bindings) refer to on object in that collection? If 
so, what's the syntax?

Ex: my GameEngine class has an @property (nonatomic, strong) Player *player;

The Player class, in turn, has an @property (nonatomic, strong) NSMutableArray 
*inventory;

and the following method

-(void)addThing:(Thing *)theThing;

If I want to refer to a 'Thing' in the player's inventory using a key path, how 
would I do it?

i.e. [[GameEngine sharedEngine] valueForKeyPath:@"player.inventory???"] to 
return an id pointer to some Thing object in the player's inventory (let's say 
I want the first one - [inventory objectAtIndex:0])?

Can I do @"[player.inventory objectAtIndex:0]" as the path?


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to