I don’t know if it’s related to result builder but yesterday I had a The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions in a SwiftUI view that was quite difficult to catch. Here’s a minimal reproduction:
struct ContentView: View {
@State var selection = ""
@State var a: Int?
@State var b: Int?
@State var c: Int?
var body: some View { // ❌ The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
ScrollView {
VStack {
Picker(selection: $selection) {
ForEach(["a", "b", "c"], id: \.self) {
Text($0)
.foregroundStyl(.red) // Typo Here
}
} label: {
}
.pickerStyle(.segmented)
}
.padding(.horizontal)
}
.onChange(of: a) { oldValue, newValue in
}
.onChange(of: b) { oldValue, newValue in
}
.onChange(of: c) { oldValue, newValue in
}
}
}
Subtle changes such as commenting one onChange(of:), pickerStyle(.segmented) and padding(.horizontal) lead to the correct Value of type 'Text' has no member 'foregroundStyl' diagnostic.
Xcode Version 26.0.1 (17A400)