DEV Community

Saurabh Chavan
Saurabh Chavan

Posted on

1

confirmationDialog() in swiftUI

confirmationDialog is basically a alert message which comes from the bottom

if you instagram user then I am sure you will saw this pop which comes from the bottom

the code and output are as follow:

import SwiftUI

struct ContentView: View {
   @State private var showConfirmation = false

    var body: some View{
        Button("Click me") {
            showConfirmation = true
        }
        .confirmationDialog("Value", isPresented: $showConfirmation) {
            Button("Save"){}
            Button("Delete",role: .destructive){}
            Button("cance",role: .cancel){}
        }
    }
}




struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
Enter fullscreen mode Exit fullscreen mode

outPut

Image description

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay