🖼️ GeometryReader
Last updated
Last updated
用法:
A GeometryReader is configured with a ViewBuilder (just like any other container view), but unlike other containers, the view builder for a geometry reader receives a parameter: the GeometryProxy.
The proxy has a property for the view’s proposed layout size and a subscript to resolve anchors.
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