//
// ContentView.swift
// Mini-SwiftUI-Project-Alert
//
// Created by WilliamJiamin on 2024/6/18.
//
import SwiftUI
struct ContentView: View {
@State private var isShowingAlert = false
var body: some View {
VStack {
Button("Trigger Alert") {
isShowingAlert = true
}
.alert("Alert!!!", isPresented: $isShowingAlert) {
Button("OK"){
print("Press OK")
}
Button("Undo", role: .destructive) {
print("Undo the texting")
}
Button("Cancel", role: .cancel){
print("cancel")
}
}
}
.padding()
}
}
#Preview {
ContentView()
}