bindings keypaths and collections
bindings keypaths and collections
- Subject: bindings keypaths and collections
- From: William Squires <email@hidden>
- Date: Sun, 29 Jul 2012 13:15:00 -0500
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 (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