I have a More button in my nav bar that contains a Delete action, and when you tap that I want to show a confirmation dialog before performing the deletion. In order words, I have a toolbar containing a toolbar item containing a menu containing a button that when tapped needs to show a confirmation dialog.
In iOS 26, you're supposed to add the confirmationDialog on the view that presents the action sheet so that it can point to the source view or morph out of it if it's liquid glass. But when I do that, the confirmation dialog does not appear. Is that a bug or am I doing something wrong?
struct ContentView: View {
@State private var showingDeleteConfirmation = false
var body: some View {
NavigationStack {
Text("👋, 🌎!")
.toolbar {
ToolbarItem {
Menu {
Button(role: .destructive) {
showingDeleteConfirmation.toggle()
} label: {
Label("Delete", systemImage: "trash")
}
.confirmationDialog("Are you sure?", isPresented: $showingDeleteConfirmation) {
Button(role: .destructive) {
print("Delete it")
} label: {
Text("Delete")
}
Button(role: .cancel, action: {})
}
} label: {
Label("More", systemImage: "ellipsis")
}
}
}
}
}
}