View controller lifecycle behaviors

A few weeks ago I shared a post suggesting that behaviors should be encapsulated in small reusable ViewControllers. The implementation wasn’t perfect then. This post follows the same path for encapsulating behaviors and avoiding the “mega ViewController” problem with a better implementation. Very interesting.


Everyone hate huge ViewControllers but in reality it’s really hard to avoid them. This post will show you a few methods to avoid this code smell. For example: splitting the Network Code and subclassing UIView to encapsulate related code like data validation.

Massive View Controllers

Many Controllers Make Light Work

Another interesting approach to ViewControllers. Using lots of view controllers, each responsible for a specific piece of behavior. For example, instead of common “analytics” code in a parent ViewController that all other ViewControllers inherit from, creating a tiny AnalyticsViewController and using that when needed. If you need motivation read “Composition over inheritance” in wikipedia.