I thought I would share my findings in case anyone else is curious how this line of code from Listing 17.19 affects the app’s layout:
segue.destination.additionalSafeAreaInsets = UIEdgeInsets(top: 0, left: 0, bottom: 160, right: 0)
I wanted to know exactly what this did to the layout, as it wasn’t immediately obvious to me. Once you finish the chapter, create a bunch of mood entries in the app (more than enough to fill the screen). Then swipe upwards a lot and watch how the bottom entry’s cell springs back down and comes to rest just a little above the “add mood” button. That’s what we achieved by adding another 160 points of bottom edge inset.
But if you change that value of 160 to a 0 and run the test again, you will see that no matter how high up you try to pull the list of items, it will always spring back down so that the lower cells are obscured by the interface.
If you change the value to 400 and run it again, you can pull the bottom of the list up and it will come to rest quite high up in the interface.
So basically, this is how the table view interacts with the edge insets. The edge insets determine the boundaries of the area where the table view’s contents are displayed. Importantly, this affects the behavior of how the table scrolls.
You can tweak the other three edge inset values (top, left, and right) to see what effect that has.