Summary

In this chapter, we looked at how to implement a view controller with a table view using TDD. We split the table view controller into code that manages the view hierarchy and code for the data source, and the delegate of the table view.

We discussed how to write tests to drive the development of subviews, outlets, and actions, and how to use fake objects to isolate the microfeature to be tested. The usage of mock objects allowed us to create fast, isolated, and reliable tests. This way, we were able to write tests for the table view cell without the need to instantiate the real data source of the table view.

Next, we implemented the detail view controller using TDD. We added MapKit to the project in order to show the location of the ...

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.