A Test-Driven View Controller

View controllers are glue-like components that hold an app together. They are responsible for the moderation between the model and the view layer. As moderators, they are highly-specialized according to the needs of the model and the user interface they belong to. As a result, the controller layer is often not reusable in other parts of the app, or even in other apps.

As the controller is responsible for many different tasks, it often becomes large. It is a good practice, therefore, to construct the controller layer of a specific feature out of different controller classes. For instance, beginners often put their networking code into the same class that is responsible for filling the UI with information. This ...

Get Test-Driven iOS Development with Swift 4 - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.