adwaita-swift/Sources/Demo/AlertDialogDemo.swift
david-swift 5613ce13cd
Some checks failed
SwiftLint / SwiftLint (push) Successful in 6s
Deploy Docs / publish (push) Failing after 25s
Fix memory leaks
2025-01-23 13:02:11 +01:00

41 lines
825 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
}
.pill()
.suggested()
.frame(maxWidth: 100)
.padding()
}
.alertDialog(visible: $dialog, heading: "Alert Dialog", body: "This is an alert dialog") {
CounterDemo()
}
.response("Cancel", role: .close) {
print("Cancel")
}
.response("Done", appearance: .suggested, role: .default) {
print("Done")
}
}
}
// swiftlint:enable missing_docs