Sharing layout information in SwiftUI

SwiftUI provides container views such as stacks and lists, which we use to lay out the views in our user interface. However, when such container views are not enough to help us get our layout just right, SwiftUI also provides the GeometryReader type, which defines its content as a function of its own size and coordinate space. In this post, Federico Zanetello shows us how we can use GeometryReader, together with PreferenceKey, to share layout information from child views to ancestor views.