title: GeometryReader in SwiftUI ScrollView causes weird behaviour and random offset
body: <p>Im trying to create a ScrollView that in turn contains a GeometryReader (Explicitly not the other way around). The GeometryReader should contain an (image) with a fixed width and height. However when doing this, the ScrollView pushes the view &quot;above&quot; the screen, it seems like it's applying some random vertical offset.</p>
  <p><a href="https://i.stack.imgur.com/0fy52.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0fy52.png" alt="enter image description here" /></a></p>
  <pre><code>var body: some View {
      ScrollView {
          GeometryReader { geometry in
              Image(&quot;hp&quot;)
                  .resizable()
                  .aspectRatio(contentMode: .fill)
                  .frame(width: geometry.size.width, height: 400)
                  .clipped()
          }
      }
  }
  </code></pre>
  <p>When removing the GeometryReader and just inserting the image it works fine.</p>
  <p>Can somebody help?</p>
  <p>Edit: Found a solution. I achieved the desired behaviour by telling the image that it should be as high and wide as the inner geometry reader. Then i'm setting the inner geometry reader</p>
  <pre><code>var body: some View {
      GeometryReader { outerGeometry in
          ScrollView {
              VStack {
                  GeometryReader { innerGeometry in
                      Image(&quot;hp&quot;)
                          .resizable()
                          .aspectRatio(contentMode: .fill)
                          .frame(width: innerGeometry.size.width,
                          height: innerGeometry.size.height)
                          .offset(y: innerGeometry.frame(in: .global).minY/7)
                          .clipped()
                  }
                      .frame(width: outerGeometry.size.width, height: 300)
              }
          }
      }
  }
  </code></pre>