GemeotryReader and NavigationView result into view updating twice

I've prepared a small example to reproduce my issue. I have a view (in this case, ContentView) that I use as a proxy to wrap some content (OtherView) into a GeometryReader. This is done because the space available is needed in my real view (not in this example) to make some calculations and I'd rather not have proxy.size as argument in 10 different functions.

There's a Binding, a State variable and a DragGesture that updates both variables when ended. For some reason, the update occurs in two steps (first the state, then the binding) rather than all at once:
Code Block
struct OtherView: View {
let size: CGSize
@Binding var page: Int
@State var draggingOffset: CGFloat = 0
var body: some View {
Text(text())
.frame(width: size.width,
height: size.height / 2)
.background(Color.blue)
.gesture(
DragGesture(minimumDistance: 15)
.onChanged { value in
withAnimation {
draggingOffset = value.translation.width
}
}
.onEnded { _ in
print("\n\n* RESET **")
withAnimation {
page += 1
draggingOffset = 0
}
}
)
}
func text() -> String {
print("page: \(page) offset: \(draggingOffset)")
return "page: \(page) offset: \(draggingOffset)"
}
}
struct ContentView: View {
@State private var value: Int = 0
var body: some View {
NavigationView {
GeometryReader { proxy in
OtherView(size: proxy.size,
page: $value)
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}

This prints:
Code Block
page: 0 offset: 0.0
...
...
page: 0 offset: -239.3333282470703
* RESET **
page: 1 offset: -239.3333282470703
page: 1 offset: 0.0

If now I remove the NavigationView or move the GeometryReader to OtherView, the update occurs in just one step.
Code Block
* RESET **
page: 1 offset: 0.0

I have same problem.
I can't get the frame size of proxy if I put the GeometryReader in NavigationView.

GemeotryReader and NavigationView result into view updating twice
 
 
Q