Tools: [SUI] GeometryReader

Tools: [SUI] GeometryReader

Bibliografía GeometryReader define su contenido como una función del tamaño que tiene disponible. Este recibe un objeto GeometryProxy que tiene un método frame(in:) y unas propiedades size y safeAreaInset que informan del tamaño del contenedor. Es posible que necesite saber la posición del GeometryReader con respecto a otro contenedor externo, para lo que se usa frame(in:). Este modificador recibe como argumento global, local o named(_:). Este último permite relacionar el GeometryReader con un contenedor específico, al aplicar coordinateSpace(_:) al contenedor de interés. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to ? It will become hidden in your post, but will still be visible via the comment's permalink. as well , this person and/or CODE_BLOCK: VStack { GeometryReader { geometryProxy in let distanceFromTop = geometryProxy.frame(in: "container").origin.y Text("This view is \(distanceFromTop) points from the top of the VStack") } .padding() } .coordinateSpace(.named("container")) CODE_BLOCK: VStack { GeometryReader { geometryProxy in let distanceFromTop = geometryProxy.frame(in: "container").origin.y Text("This view is \(distanceFromTop) points from the top of the VStack") } .padding() } .coordinateSpace(.named("container")) CODE_BLOCK: VStack { GeometryReader { geometryProxy in let distanceFromTop = geometryProxy.frame(in: "container").origin.y Text("This view is \(distanceFromTop) points from the top of the VStack") } .padding() } .coordinateSpace(.named("container")) - Gauchat, J. D. (2024). SwiftUI for Masterminds: How to take advantage of Swift and SwiftUI to create insanely great apps for iPhones, iPads, and Macs (5a ed.). John D Gauchat.