I have such inits with ViewBuilders with TupleView
// MARK: TupleView support
public init<A: View, B: View>(@ViewBuilder content: () -> TupleView<(A, B)>) {
let views = content().value
self.childs = [AnyView(views.0), AnyView(views.1)]
}
Code works great, but starting from new Xcode 11.3 update (iOS 13.3) this code stopped working, and constructor with TupleView is not executed.
Here is how I use MenuView with such initializer:
MenuView {
DashboardView()
.withTag(0)
.tabBarItem {
TabItemView(imageName: "Dashboard", title: "Home")
},
ContactsView(companyId: self.getCompanyId())
.withTag(1)
.tabBarItem {
TabItemView(imageName: "Contacts", title: "Contacts")
}
}
But now it doesn't work this @ViewBuilder and do not I think call ViewBuilder.buildBlock() correctly and this argument is recognized as call to
public init<Content: View>(@ViewBuilder content: () -> Content>) { }
I found the workaround, but it is very ugly code and it is far away how we can use native TabView for instance.
MenuView {
ViewBuilder.buildBlock(
DashboardView()
.withTag(0)
.tabBarItem {
TabItemView(imageName: "Dashboard", title: "Home")
},
ContactsView(companyId: self.getCompanyId())
.withTag(1)
.tabBarItem {
TabItemView(imageName: "Contacts", title: "Contacts")
}
)
}