confirmationDialog crashes with Button.init(action, @ViewBuilder label)

My app gets killed with the error message: Actions added to UIAlertController of style UIAlertActionStyleDefault must have a title when running in UIUserInterfaceIdiomPhone

if I use one sort of button, but not the shorter sort. This code produces the error, but it I remove the button with Image(systemName:) I get that error.

Button(action: { showingExtras = true } ) { 
   Image(systemName: "ellipsis.rectangle") 
}
  .confirmationDialog("Extras", isPresented: $showingExtras) {
    Button(action: { showingCashSummary = true} )  {
      Image(systemName: "banknote")
    }
    Button("Cash summary") { showingCashSummary = true }
    Button("Allocation summary") {showingAllocationSummary = true}
    Button("Export") { isExporting = true }
}

Is there some way to add the title that UIAlertController requires?

Answered by swiftuiforever in 753403022

Check the help for confirmationDialog. It states

On iOS, tvOS, and watchOS, confirmation dialogs only support controls with labels that are Text. Passing any other type of view results in the content being omitted.

Accepted Answer

Check the help for confirmationDialog. It states

On iOS, tvOS, and watchOS, confirmation dialogs only support controls with labels that are Text. Passing any other type of view results in the content being omitted.

confirmationDialog crashes with Button.init(action, @ViewBuilder label)
 
 
Q