“There are only two hard things in Computer Science: cache invalidation and naming things.”
— Phil Karlton
My opinion that this Chapter is the Core of this Book, everything starts by naming.
The book states that if a name requires a comment, then the name does not reveal it’s intent.
GeometryReader provides us with an input value telling us the width and height we have available, and we can then use that with whatever calculations we need.
With other words: GeometryReader is thing that recognize geometry of parents view means when you create a view in the geometry you get size of your parent view.
As you can see, GeometryReader’s closure has the parameter called geometry. This parameter is an instance of GeometryProxy struct. You can use an instance of GeometryProxy to access information about the coordinate space using the following properties.
size — The size of space available to GeometryReader.
the book discourages you to write comments, because if you wrote good, clean, and informative code, you shouldn’t need to have comments in the first place.
if we write good variable and function names, comments are not necessary.
The observer pattern lets one object observe changes on another object. Apple added language-level support for this pattern in Swift 5.1 with the addition of Publisher in the Combine framework.
This is a behavior pattern, it focused to observe changes on other object.