Skip to content

Instantly share code, notes, and snippets.

@fantactuka
Created November 19, 2012 19:21
Show Gist options
  • Save fantactuka/4113044 to your computer and use it in GitHub Desktop.
Save fantactuka/4113044 to your computer and use it in GitHub Desktop.
Stupid Objective C hashes
NSMutableDictionary *requestConfig = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"GET", @"method",
@"/", @"path",
[[NSMutableDictionary alloc] init], @"params",
^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"[Request] Success: %@", responseObject);
}, @"success",
^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"[Request] Failure: %@", error);
}, @"failure",
nil];
// Compared with way more readable
NSMutableDictionary *requestConfig = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"method", @"GET",
@"path", @"/",
@"params", [[NSMutableDictionary alloc] init],
@"success", ^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"[Request] Success: %@", responseObject);
},
@"failure", ^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"[Request] Failure: %@", error);
},
nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment