-
-
Save edopelawi/bc65b7eed025be56be33 to your computer and use it in GitHub Desktop.
Slightly better than JumbledParamaterNetworkService.m . Here, you can move the payload creation (plus all the check it needs) to RPSUser class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@class RPSUser | |
@property (nonatomic, copy) NSString *name; | |
@property (nonatomic, copy) NSString *email; | |
@property (nonatomic, copy) NSString *address; | |
/// Used only to create @p payloadDictionary. | |
@property (nonatomic, copy) NSString *password; | |
/// Payload dictionary made from this instance's properties. | |
- (NSDictionary *)payloadDictonary; | |
/// Rest of your implementation here... | |
@end | |
/// The result of this method will be sent via the @p RACSignal. | |
- (RACSignal *)registerNewUser:(RPSUser *)user | |
{ | |
NSDictionary *payload = [user payloadDictionary]; | |
// 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