Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created November 19, 2013 08:54
Show Gist options
  • Save nevyn/7542335 to your computer and use it in GitHub Desktop.
Save nevyn/7542335 to your computer and use it in GitHub Desktop.
@implementation MeteorClient (GFTask)
- (SPTask*)gf_sendMethod:(NSString*)method parameters:(NSArray*)params
{
SPTaskCompletionSource *source = [SPTaskCompletionSource new];
[self sendWithMethodName:method parameters:params responseCallback:^(NSDictionary *response, NSError *error) {
if(error) {
[source failWithError:error];
} else {
[source completeWithValue:response];
}
}];
return source.task;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment