1

I have a scroll view, in which i have table. Columns of the table are resizable, and that is done through the RView, width that it is changing is the width of the column. Width of the column is set on the sample view. Total width of the table is additive of the width of eachColumn. Dragging on the columns at the beginning of the table results in the normal drag. But when dragging at the end. The drag is too fast. Maybe it is caused by that that the total width of the frame is changed and the RView is placed on this new position too, but I am not aware of the solution that can change this behaviour.

  HStack { 
      ForEach(columns) { column in 
          ZStack(alignment: .trailing) {
                sampleView()
                .frame(width: width)
                /// Other views above
                RView(coordinateSpace: coordinateSpace, width: $width)
          }
      }
  }.frame(width: totalWidthOfColumns from columns)


struct RView: View {
let coordinateSpace: String
@Binding
var width: CGFloat

var body: some View {
    Image(systemName: "star.fill")
        .gesture(
            DragGesture(minimumDistance: 0, coordinateSpace: .named(coordinateSpace))
                .onChanged { gesture in
                    let distance = gesture.translation.width
                    print(distance)
                    width += distance
                }
        )
}
}
Jason Krowl
  • 84
  • 2
  • 15
  • Hi, I have an update to this question, well it is question on its own more or less, so I am linking it here. They are related, but not the same. Each of these deserves it's own question I guess. https://stackoverflow.com/questions/72668362/why-is-it-that-when-the-draggable-view-is-further-than-the-max-of-the-frame-th – Jason Krowl Jun 18 '22 at 10:01

0 Answers0