🌿 Alert
struct ContentView: View {
@State private var showing = false
var body: some View {
Button("Alert 띄우기") {
showing = true
}
.alert("메시지", isPresented: $showing) {
Button("OK", role: .cancel) {}
}
}
}
🌿 Action Sheet
struct ContentView: View {
@State var showingSheet = false
var body: some View {
Button(action: {
self.showingSheet = true
}) {
Text("Action Sheet 띄우기")
}
.confirmationDialog("타이틀", isPresented: $showingSheet) {
Button("제거", role: .destructive){}
Button("취소", role: .cancel) {}
}
}
}