I make an app with DDD I’m able to make clean domain layer which domains are clearly separated from other layers.
But Controllers on presentations layer are mess.
ViewControllers have multiple responsibilities even though domain is successfully separated. A ViewController tend to have multiple responsibilities such as
There often are many ViewControllers with slightly different functions.
If trying to make those with template method, hierarchy of ViewControllers get too complicated.
If trying to make those without template method, there will be many ViewControllers which shares some functions. This way is vulnerable to change.
What are some best practices? How to construct clean presentation layer on iOS app?
In practice, Cocoa MVC often leads to massive-view-controller problem. The solution is to move to a more fine grained architecture like MVP or VIPER.
In MVP on iOS the View is represented by UIViewController
(or bare UIView
), thus UIViewController
is no more loaded with business logic.
VIPER has even more layers and also solves UI navigation task.