Skip to content

Instantly share code, notes, and snippets.

@ccarse
Created August 1, 2012 19:40
Show Gist options
  • Save ccarse/3230017 to your computer and use it in GitHub Desktop.
Save ccarse/3230017 to your computer and use it in GitHub Desktop.
Obj-C new literal types example.
// Before
NSMutableDictionary *mainDict = [[NSMutableDictionary alloc] init];
[mainDict setObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSNumber numberWithBool:false], serverBlob, nil]
forKeys:[NSArray arrayWithObjects:@"moreChangesAvailable", @"serverBlob", nil]], changes, nil]
forKeys:[NSArray arrayWithObjects:@"__sync", @"results", nil]]
forKey:@"d"];
// After
NSDictionary *mainDict = @{@"d":@{@"__sync":@{@"moreChangesAvailable":@0, @"serverBlob":serverBlob}, @"results":changes}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment