Add confirmationDialog (action sheet)#47
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
.confirmationDialog(_:isPresented:titleVisibility:message:buttons:)— a real public API, and the natural sibling of the existing.alert. Unlike an alert's two-buttonAlertDialog, a confirmation dialog lays out any number of choices vertically as a bottom action sheet, matching iOS.Shape
_AlertViewpattern: emits a hiddenConfirmationDialogchild of its content (hasConfirmationDialogflag on the parent), reusingAlertButtonand its roles. Each button's callback runs the action and writesisPresented = false, so Swift stays the source of truth.Visibilityenum fortitleVisibility(the title is hidden by default, shown when.visible, matching iOS).ModalBottomSheet: optional title/message header, then one full-widthTextButtonper choice, with.destructivebuttons 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 passingNote
Like
alert, the dialog is picked up when attached at the current navigation screen's root (RenderSheetsAndAlertsscans the top screen's children) — same scope as the existing alert/sheet.