Alert isn't presenting when I use confirmationDialog and alert in a single View.
struct ConfirmationDialog: View {
@State private var showingOptions = false
@State private var showingAlert = false
var body: some View {
VStack {
Button("Show Options") {
showingOptions = true
}
.alert("Alert Title", isPresented: $showingAlert, actions: {
Button {
// Do nothing
} label: {
Text("Okay")
}
}, message: {
Text("Alert Message")
})
.confirmationDialog("Select option", isPresented: $showingOptions, titleVisibility: .visible) {
Button("Show Alert") {
self.showingAlert = true
}
}
}
}
}
I'm getting a console log when confirmationDialog is presented for the first time.
Attempting to present an alert while a confirmation dialog is already presented. This is not supported.
I'm using XCode 13 and iOS 15 simulator. I tried even changing the sequence it didn't worked
Is it a bug in XCode 13 or there are any other ways to fix it.
Link for StackOverflow