See the following sample code:
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 20) {
ForEach(0 ..< 12) { index in
Rectangle()
.foregroundColor(.white)
.frame(width: 100, height: 100, alignment: .center)
.shadow(radius: 20)
}
}
}
This sample code will result in a horizontal ScrollView
with Rectangle as elements.
However, as it seems the ScrollView actually clips it's content so any shadow on the top and bottom will be clipped.
Is there any way to disable automatic clipping by the scrollview or another way to achieve this?