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 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.