Skip to content

Commit a038ed6

Browse files
committed
Demonstrate confirmationDialog in the presentation gallery
1 parent ef0076e commit a038ed6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Demo/App.swiftpm/Sources/PresentationPlaygrounds.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ struct SheetBody: View {
8989
struct AlertPlayground: View {
9090
@State private var simple = false
9191
@State private var confirm = false
92+
@State private var sheet = false
9293
@State private var result = "No choice yet"
9394
var body: some View {
9495
ScrollView {
9596
VStack(spacing: 16) {
9697
Button("Show simple alert") { simple = true }
9798
Button("Show confirmation") { confirm = true }
99+
Button("Show confirmation dialog") { sheet = true }
98100
Text(result)
99101
}
100102
.padding()
@@ -104,5 +106,13 @@ struct AlertPlayground: View {
104106
AlertButton("Cancel", role: .cancel) { result = "Cancelled" },
105107
AlertButton("Delete", role: .destructive) { result = "Deleted" },
106108
])
109+
.confirmationDialog("Manage item", isPresented: $sheet,
110+
titleVisibility: .visible,
111+
message: "Choose an action", buttons: [
112+
AlertButton("Duplicate") { result = "Duplicated" },
113+
AlertButton("Share") { result = "Shared" },
114+
AlertButton("Delete", role: .destructive) { result = "Deleted from dialog" },
115+
AlertButton("Cancel", role: .cancel) { result = "Dialog cancelled" },
116+
])
107117
}
108118
}

0 commit comments

Comments
 (0)