Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single completion handler? #1

Closed
jashsayani opened this issue Aug 24, 2014 · 0 comments
Closed

Single completion handler? #1

jashsayani opened this issue Aug 24, 2014 · 0 comments

Comments

@jashsayani
Copy link

iOS convention has a single completion handler for async calls, instead of a success and failure callback.

[uberKit getPriceForTripWithStartLatitude:START_LAT startLongitude:START_LONG endLatitude:END_LAT endLongitude:END_LONG success:^(NSArray *prices)
failure:^(NSError *error, NSHTTPURLResponse *response)];

Would become:

[uberKit getPriceForTripWithStartLatitude:START_LAT startLongitude:START_LONG endLatitude:END_LAT endLongitude:END_LONG withCompletionHandler:^(NSArray *prices, NSError *err)];

If there is an NSError, then the message in the error can be displayed, otherwise the prices array can be accessed.

I believe this would clean the code and make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants