'SwiftUI: Ternary Operator causing astronomical build times

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source