title: SwiftUI | DragGestures onEnded never called if canceled by ScrollView
body: <p>I have the following problem.</p>
  <p>I have a <code>View</code> inside a <code>ScrollView</code> that I want to drag.
  Now, everything works fine, the dragging occurs and the scrolling as well. But once I try to do both, the <code>dragOffset</code> appears to stay, instead of resetting to its initial position.</p>
  <p>More so, <code>onEnded</code> of the <code>DragGesture</code> never happens. How can I stop this from happening and reset the green <code>Rectangle</code> to its initial position?</p>
  <h2>Visual representation</h2>
  <p>Dragging or scrolling works just fine.</p>
  <p><img src="https://i.stack.imgur.com/KkLBw.gif" width="200"> <img src="https://i.stack.imgur.com/IPoa9.gif" width="200"></p>
  <p>But whenever I do both, this happens.</p>
  <img src="https://i.stack.imgur.com/Q2JWT.gif" width="200">
  <h2>Demo Code</h2>
  <pre><code>struct ContentView: View {
      
      @State private var dragOffset: CGSize = .zero
      
      
      var body: some View {
          ScrollView {
              Rectangle()
                  .frame(width: UIScreen.main.bounds.size.width, height: 300)
                  .foregroundColor(.green)
                  .offset(x: dragOffset.width)
          }
          .gesture(DragGesture()
              .onChanged { value in
                  dragOffset = value.translation
              }
              .onEnded { value in
                  dragOffset = .zero
              }
          )
          .animation(.default)
      }
  }
  </code></pre>
  <p>Thank you!</p>