I’ve a horizontal scroll person expertise with a ScrollView
and an HStack
. I wished to determine a approach to understand that the person has reached the tip of the HStack
.
To perform that, I used this answer (open to higher options)
The performance works as anticipated and I can understand when the person is on the finish of the scrollview.
That is my code up to now
var physique: some View {
ScrollView(.horizontal) {
LazyHStack(spacing: 10) {
content material
endOfListView
}
}
}
non-public var endOfListView: some View {
Colour.clear
.body(width: .zero, top: .zero)
.onAppear {
didReachEnd = true
}
}
The difficulty I’m having now could be that even the endOfListView
has a body of .zero
, a further 10 spacing is added due to the spacing set within the HStack
constructor.
I attempted so as to add this .padding(.main, -10)
to the endOfListView
, nonetheless, that did not assist and the spacing was nonetheless there.
I additionally got here throughout the same downside however would not concern the spacing so I could not apply it.
Is there a approach override the spacing for particular components inside an HStack or another approach to resolve this ?