The structure of the app
Before we start to implement the different views of our to-do app, we need to think about the structure of our app. The app is quite simple on purpose to help keep the focus on the main topic of this book: building an app using TDD.
The table view controller, the delegate, and the data source
In iOS apps, data is often presented using a table view. Table views are highly optimized for performance; they are easy to use and implement. We will use a table view for the list of to-do items.
A table view is usually represented by UITableViewController
, which is also the data source and delegate for the table view. This often leads to a massive table view controller, because it is doing too much: presenting the view, navigating to other view controllers, and managing the presentation of the data in the table view.
To reduce the responsibility of the table view controller a bit, we will use the coordinator pattern. This way, a coordinator is responsible...