-
-
Save PaulTaykalo/8b21b87f4630dc9c631e to your computer and use it in GitHub Desktop.
Hiding business logic from View Layer
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
// Something that can be drawn | |
@protocol DrawablePerson | |
@property(nonatomic, copy) NSString * name; | |
@property(nonatomic, copy) NSString * followingStatus; | |
@end | |
@interface Person : NSObject <DrawablePerson> | |
@property(nonatomic, copy) NSString * name; | |
@property(nonatomic, copy) NSString * followingStatus; | |
@end | |
@interface PersonView : UIView | |
// Even if person have some businnes logic in it, | |
// View layer shouldn't care about it | |
// It only should care about how to draw it correctly | |
@property(nonatomic, strong) id<DrawablePerson> person | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment