I am creating an iOS application with SwiftUI
I used the master/detail template and got to this:
struct ContentView: View {
var body: some View {
NavigationView {
if (conditionsForMasterDetail)
{
masterView
.navigationBarTitle(Text("Master"))
.navigationBarItems(
leading: EditButton(),
trailing: Button(
action: {
withAnimation { self.dates.insert(Date(), at: 0) }
}
) {
Image(systemName: "plus")
}
)
}
if (conditionsForDetaiView)
{
detailView
}
} //NavigationView
.navigationViewStyle(DoubleColumnNavigationViewStyle()).toolbar {
ToolbarItem(placement: .primaryAction) {
Menu
{ //error here: “Trailing closure passed to parameter of type 'MenuStyleConfiguration' that does not accept a closure”
NavigationLink(destination:HelpView(appData: appData))
{ Button(action: {}) {
Label(help_menu_item, systemImage: "")
}
}
Button(action: {}) {
Label(liability_disclaimer_menu_item, systemImage: "")
}
Button(action: {}) {
Label(R.string.about_menu_item, systemImage: "")
}
}//menu
label: {//error here: Extra argument 'label' in call
Label("Menu", systemImage: "")
}
}//toolbar item
}//toolbar
} //body
} //ContentView
The problem is the menu, because an error is issued:
Trailing closure passed to parameter of type 'MenuStyleConfiguration' that does not accept a closure
Note that the trailing closure is just a different way to write parameters of an initializers. Menu seems to accept a configuration but I see the content and the label (error on label: Extra argument 'label' in call).
I tried all kind of writing the init without the trailing closure syntax but it does not lead to working code.
I would like to know if it is a bug or it is a real error.