0

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

Nasir
  • 1,617
  • 2
  • 19
  • 34
  • What's inside that builder block? Does it really returns `TextFieldAlert`? – Asperi Sep 04 '20 at 17:08
  • Xcode 12 has an initializer like this `public func alert(isPresented: Binding, content: () -> Alert) -> some View`, probably signature is ambigious for compiler somehow (may be Alert is also a `ViewBuilder`) – Enes Karaosman Sep 04 '20 at 19:04

0 Answers0