Navigating to a modal view
Normally, testing the presentation of a modal view controller is quite complicated. If you search how to do that on the internet, you will find that the common solutions work by swizzling the present(_:animated:completion:)
method defined in the UIViewController
class. Swizzling is quite complicated, and I will not show in this book how this is done.
But, because we are using the coordinator pattern for the navigation in our app, we can test the presentation without the need to swizzle any method. Still, you should look up how to swizzle methods because sometimes you don't have the option to use the coordinator pattern; for example, when there is already all the navigation code implemented and you are not allowed to change it.
Follow these steps to implement the presentation of the input view when the user chooses to add a new to-do item:
- The app needs a button in the user interface that the user can tap to add a to-do item. When the user...