API – Model – View – ViewDelegate – ViewController
API’s result consist of the Models
The Model should be generalized and be well defined.
View describe the information of model.
The relationship of each other.
Model(one) – API(many)
Many api’s result can be generalized well defined Model.
Model(one) – View(many)
One model can be represented to many View.
View(one) – ViewDelegate(one)
ViewDelegate (one) – ViewController(include bridge controller) (one)
Abstract ViewController from View,ViewDelegate
Good abstraction of the combination of View,ViewDelegate,ViewController will remove dup code for same TableViewCell, CollectionViewCell, CustomView.
OOP + Category
// example @interface User : NSObject @property(nonatomic, assign) BOOL following; @end @interface User(API) - (void)api_follow; - (void)api_unfollow; @end - (void)touchUpFollowToggleButton:(CustomFollowToggleButton *)sender { User *user = self.items[indexPath.row]; if (user.following) { [user api_unfollow]; sender.follow = NO; } else { [user api_follow]; sender.follow = YES; } }