Skip to content

Instantly share code, notes, and snippets.

@PaulTaykalo
Last active August 29, 2015 14:27
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 PaulTaykalo/8b21b87f4630dc9c631e to your computer and use it in GitHub Desktop.
Save PaulTaykalo/8b21b87f4630dc9c631e to your computer and use it in GitHub Desktop.
Hiding business logic from View Layer
// 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