2

I'm working with SwiftUI and simply want to change the frame of a VStack depending on a condition. When I write the code like this:

ForEach(0..<array.count) { i in
    VStack {
        ZStack {
            ...
        }
    }
}

it builds just fine. But as soon as I add .frame(width: i == 1 ? 80 : 50) to the VStack, the build stalls (it does not actually build at all) and makes my computers fans go crazy. I've tried wrapping the VStack in an if-statement as well and the result is no better.

Does anyone know what might be causing this error or how I could go about fixing it?

Thank you in advance.

Nicolas Gimelli
  • 695
  • 7
  • 19

0 Answers0