Dialog
Represent a Material UI styled dialog for user interaction.
Overview
The Dialog view presents modal content in a styled overlay, typically used for important alerts or user interactions requiring attention.
The dialog
modifier allows you to present a Material Design styled alert dialog from any SwiftUI view. You can configure the dialog with a title, message, and actions, including primary and optional secondary buttons.
To use the dialog
modifier, apply it to any View with the required parameters.
Modifiers
Present a simple dialog with a title and message.
Present an dialog with a title, message, and a primary button.
Present an dialog with a title, message, and both primary and secondary buttons.
Parameters
isPresented
A Binding<Bool>
to control the presentation of the dialog.
titleKey
A String
representing the title of the dialog.
message
A String
for the dialog message.
primaryActionKey
A String
for the title of the primary action button.
primaryAction
A closure to execute when the primary button is tapped.
secondaryActionKey
An optional String
for the title of the secondary action button.
secondaryAction
An optional closure to execute when the secondary button is tapped.
Example
Displays a basic dialog with a title and message.
Displays a dialog with a title, message, and a primary action button.
Displays a dialog with title, message, and both primary and secondary action buttons.
Last updated