Objective C selector tutorial
Submitted by saltzmanjoelh on Wed, 12/09/2009 - 20:31In php to do dynamic typing you do something like
$key = 'id';
$assoc = array('id' => 1);
echo $assoc[$key];
In objective c you would use a selector.
SEL key = @selector(id)
//or
//SEL key = NSSelectorFromString(@"id");
//Then
NSDictionary *assoc =
[NSDictionary dictionaryWithObjectsAndKeys: @"1", @"id", nil];
NSLog([assoc performSelector: key]);
If you have setters and getters
-(void)children;
-(void)setChildren:(NSArray *) newChildren;