How to show native iOS confirmation popup attached to button (like Apple Reminders app) in SwiftUI?

2 hours ago 1
ARTICLE AD BOX

I'm trying to replicate the native iOS confirmation popup that appears attached to a button like in Apple's Reminders app when you tap the X button to discard changes.

What I want (Apple Reminders behavior):

[SCREENSHOT 1 - Reminders app confirmation attached to X button] enter image description here

The confirmation popup appears directly below the X button with a subtle connection to it, not as a centered alert.

What I'm getting:

Using .alert() or .confirmationDialog() shows the dialog in the center of the screen as a standard alert — not attached to the button.

My current approach:

struct MyView: View { @Environment(\.dismiss) private var dismiss @State private var showDiscardConfirmation = false var body: some View { NavigationStack { Form { // Content here } .navigationTitle("New Reminder") .toolbar { ToolbarItem(placement: .cancellationAction) { Button { showDiscardConfirmation = true } label: { Image(systemName: "xmark") .font(.system(size: 14, weight: .semibold)) .foregroundColor(.secondary) .frame(width: 30, height: 30) .background(Color.gray.opacity(0.1)) .clipShape(Circle()) } // This shows centered alert, not attached popup .confirmationDialog( "Are you sure you want to discard this new reminder?", isPresented: $showDiscardConfirmation, titleVisibility: .visible ) { Button("Discard Changes", role: .destructive) { dismiss() } } } } } } }

What I've tried:

.alert() — shows centered alert .confirmationDialog() — shows action sheet from bottom on iPhone .popover() — doesn't match the native Apple styling

Question:

How does Apple achieve this button-attached confirmation popup in their Reminders app? Is there a native SwiftUI modifier for this, or does it require UIKit (UIAlertController with popoverPresentationController)?

Looking for native solutions — iOS 16+ is fine.

Read Entire Article