Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Test-Driven iOS Development with Swift

You're reading from   Test-Driven iOS Development with Swift Create fully-featured and highly functional iOS apps by writing tests first

Arrow left icon
Product type Paperback
Published in Feb 2016
Publisher Packt
ISBN-13 9781785880735
Length 218 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Dominik Hauser Dr. Dominik Hauser
Author Profile Icon Dr. Dominik Hauser
Dr. Dominik Hauser
Arrow right icon
View More author details
Toc

Chapter 4. A Test-Driven View Controller

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

As the controller is responsible for many different tasks, it often tends to become big. It is a good practice to construct the controller layer of one 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 results in a so-called "god" class, a class that knows and controls everything.

Such classes are hard to write, read, and maintain and should, therefore, be avoided. To make the View Controller showing the list of items clean, we will separate...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime