Skip to content

Add confirmationDialog (action sheet)#47

Merged
colemancda merged 4 commits into
masterfrom
feature/confirmation-dialog
Jul 23, 2026
Merged

Add confirmationDialog (action sheet)#47
colemancda merged 4 commits into
masterfrom
feature/confirmation-dialog

Conversation

@colemancda

Copy link
Copy Markdown
Member

Adds .confirmationDialog(_:isPresented:titleVisibility:message:buttons:) — a real public API, and the natural sibling of the existing .alert. Unlike an alert's two-button AlertDialog, a confirmation dialog lays out any number of choices vertically as a bottom action sheet, matching iOS.

Shape

  • Mirrors the _AlertView pattern: emits a hidden ConfirmationDialog child of its content (hasConfirmationDialog flag on the parent), reusing AlertButton and its roles. Each button's callback runs the action and writes isPresented = false, so Swift stays the source of truth.
  • New Visibility enum for titleVisibility (the title is hidden by default, shown when .visible, matching iOS).
  • Interpreter renders it as a ModalBottomSheet: optional title/message header, then one full-width TextButton per choice, with .destructive buttons in the error color. Drag-to-dismiss calls back.

Verification

  • swift test — new emission/dismissal test (asserts the flag appears on present, the destructive button carries its role, and a choice clears the flag), 68 total passing
  • Emulator (Alert screen, new "Show confirmation dialog" button): the sheet presents with title "Manage item", message, and Duplicate / Share / Delete (red) / Cancel; tapping Delete fired its action and dismissed the sheet (result text → "Deleted from dialog")

Note

Like alert, the dialog is picked up when attached at the current navigation screen's root (RenderSheetsAndAlerts scans the top screen's children) — same scope as the existing alert/sheet.

@colemancda
colemancda merged commit db4169e into master Jul 23, 2026
6 checks passed
@colemancda
colemancda deleted the feature/confirmation-dialog branch July 23, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant