Swift Charts allows us to provide a custom gesture for selection by using the chartGesture(_:) modifier.
You can for exemple configure a SpatialTapGesture to get the tap location and update the chart angle value by calling the selectAngleValue(at:) method.
By using the below code, I managed to get rid of the "hold down" behaviour.
.chartGesture { chart in
SpatialTapGesture()
.onEnded { event in
let angle = chart.angle(at: event.location)
chart.selectAngleValue(at: angle)
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: