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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.