used by .getSize() to do something with view's size.
Using the subscript, you can get the size and position of any subview down the view tree.
็จๆณ๏ผ
GeometryReader { geometry in
// geometry.size๏ผsize of the paraent
// geometry.frame(in: .global)๏ผbounds of the parent
}
A GeometryReader is con๏ฌgured with a (just like any other container view), but unlike other containers, the view builder for a geometry reader receives a parameter: the .
The proxy has a property for the viewโs proposed layout size and a subscript to resolve .
GeometryReader reports its proposed size back as the actual size. Because of this sizing behavior, geometry readers are often especially useful when used as the background or overlay of another view: they become the exact size of the view. We can use this size either to draw something in the bounds of the view or to measure the size of the view.
๐ Thinking in SwiftUI, p.89, Ch.5, Custom Layout - GeometryReader