adwaita-swift/Tests/AlertDialogDemo.swift
2024-05-06 16:18:49 +02:00

39 lines
808 B
Swift

//
// AlertDialogDemo.swift
// Adwaita
//
// Created by david-swift on 05.04.24.
//
// swiftlint:disable missing_docs
import Adwaita
struct AlertDialogDemo: View {
@State private var dialog = false
let padding = 20
var view: Body {
VStack {
Button("Show Dialog") {
dialog = true
}
.style("pill")
.style("suggested-action")
.frame(maxWidth: 100)
.padding()
}
.alertDialog(visible: $dialog, heading: "Alert Dialog", body: "This is an alert dialog")
.response("Cancel", role: .close) {
print("Cancel")
}
.response("Done", appearance: .suggested, role: .default) {
print("Done")
}
}
}
// swiftlint:enable missing_docs