SwiftUI @ViewBuilder issue in Xcode 12 fails to compile project in View extension

186 views Asked by At

Hi I am facing an issue in project/build compilation in Xcode 12 Beta 1-6 (SwiftUI 2.0), In scenario, Having Custom modifier in View extension.

extension View {
    public func alert(isPresented: Binding<Bool>, @ViewBuilder _ alert: () -> TextFieldAlert) -> some View {
        self.modifier(TextFieldAlertModifier(isPresented: isPresented, alert: alert()))
    }
}

As you can observe in code snippets, Once I remove @ViewBuilder from param list, then I am able to compile & run build. If this attribute exist in params then I am facing following compilation error (Type of expression is ambiguous without more context)

enter image description here

I don't see any problem with SwiftUI 1.0 (Xcode 11), Does anyone of you see this issue ? & what might be reason of it. Any hint would be ver appreciated.

Thanks

0

There are 0 answers