본문 바로가기

난 iOS개발자/SwiftUI

Alert

728x90
struct ContentView: View {
    @State private var showing = false
    
    var body: some View {
        VStack {
            Button("Alert 띄우기") {
                showing = true
            }
            .alert("메시지", isPresented: $showing) {
                Button("OK", role: .cancel) {
                    
                }
            }
        }
    }
}

 

728x90