Testing the app's setup
When our app starts, a coordinator should be instantiated and started. This should result in the presentation of the initial view of our app. Follow these steps to refactor the setup from using a storyboard to using a coordinator:
- Before we can refactor the setup of the app, we need a test that tells us when we break something. Select the ToDoTests group in the project navigator and add a new Unit Test Case Class instance with the name
AppSetupTests
. - Replace the content of the new class with the following:
// AppSetupTests.swift import XCTest @testable import ToDo class AppSetupTests: XCTestCase { func test_application_shouldSetupRoot() { let application = UIApplication.shared let scene = application.connectedScenes.first as? UIWindowScene let root = scene?.windows.first?.rootViewController ...