gowalla/AFNetworking — Issue #102: Typedef the success/failure blocks
Author: kcharwood
Created: 2011-11-08 15:04:35+00:00
State: open

I love the new changes made for issue 83.

Would it make since to also typedef those blocks to make them a little easier maintain?

For example, in the AFHTTPClient you could have the following:

typedef void (^AFSuccessBlock) (AFHTTPRequestOperation *operation, id responseObject);
typedef void (^AFFailureBlock) (AFHTTPRequestOperation *operation, NSError *error);

The methods could then be refactored as follows:

- (void)getPath:(NSString *)path
parameters:(NSDictionary *)parameters
success:(AFSuccessBlock)successBlock
failure:(AFFailureBlock)failureBlock;

When you are interfacing with them from the m files, the blocks will still autocomplete with the proper arguments.