DEV Community

Saurabh Chavan
Saurabh Chavan

Posted on

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("Delete",role: .destructive){}
            Button("cance",role: .cancel){}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
Enter fullscreen mode Exit fullscreen mode


Image description

Top comments (0)