1

I am using the following code to create a horizontal scroll view with negative spacing (I'm using negative spacing so the items in the stack overlap). Whenever my app is in a small window and I interact with the scroll view's slider, the app crashes with a Thread 1: EXC_BAD_INSTRUCTION (code=EXC_1386_INVOP,subcode=0x0) error. Is this a known issue or is there a more correct way to implement this design?

var body: some View {
    GeometryReader { geometry in
        ScrollView(.horizontal) {
            HStack(spacing: -20) {
                ForEach(Array(elements.enumerated()), id: \.offset) { index, element in
                    Text(element.text).zIndex(Double(index))
                }
            }.frame(minWidth: geometry.size.width)
        }
    }
}
pawello2222
  • 46,897
  • 22
  • 145
  • 209
Evan Kaminsky
  • 695
  • 10
  • 23

0 Answers0