The model layer
Now that we have covered view controllers and how they relate to views and controllers, let's take some time to look at the model layer.
Just as your controllers (other than view controllers) should not hold logic relating to views and subviews, they shouldn't hold any logic relating to the model layer. Controllers are simply bridges that get their information from the models, and update the view to reflect the current state.
Using model controllers
Just as we have controllers dedicated to managing views—the view controllers—you should consider using controllers to help communicate with complex model layers. Code bases that suffer from Massive View Controller syndrome often exhibit the following pathologies in their view controllers:
- Network calls, logic, and parsing
- Caches, data stores, or Core Data logic
- Business logic or validators
Let's first start with an interface for a message composer that exhibits Massive View Controller syndrome:
class MassiveViewController : UIViewController...