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)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay