Skip to content

Instantly share code, notes, and snippets.

View buzzdeee's full-sized avatar

Sebastian Reitenbach buzzdeee

View GitHub Profile
@valexa
valexa / editNestedDict
Created April 18, 2011 13:42
a method for changing objects inside deeply nested dictionaries
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
//create a example nested dictionary with just 4 levels
NSMutableDictionary *parent = [[[NSMutableDictionary alloc] init] autorelease];
NSDictionary *thirdChild = [NSDictionary dictionaryWithObjectsAndKeys:@"bi",@"l4",@"nar",@"l4_", nil];
NSDictionary *secondChild = [NSDictionary dictionaryWithObjectsAndKeys:thirdChild,@"l3",@"bar",@"l3_", nil];
NSDictionary *firstChild = [NSDictionary dictionaryWithObjectsAndKeys:secondChild,@"l2",secondChild,@"l2_", nil];
[parent setObject:firstChild forKey:@"l1"];
[parent setObject:firstChild forKey:@"l1_"];