Skip to content

Instantly share code, notes, and snippets.

@edopelawi
Created September 26, 2015 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edopelawi/6487ef424fc89d7c2312 to your computer and use it in GitHub Desktop.
Save edopelawi/6487ef424fc89d7c2312 to your computer and use it in GitHub Desktop.
A common mistake on network-service method that takes raw objects instead of models, resulting on really big parameters.
/// The result of this method will be sent via the @p RACSignal. Well, you can add more parameters if you want to...
- (RACSignal *)registerNewUserWithName:(NSString *)name
password:(NSString *)password
email:(NSString *)email
address:(NSString *)address
{
// Add your usual parameter validation here...
NSDictionary *payload = @{
@"user_name": name,
@"password": password,
@"email": email,
@"address": address
};
// More logic or network call here...
return networkRequestSignal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment