This is a reproducible issue, create a blank project and put a cell inside a scrollview lazyVstack, I need to have the confirmation dialog on the button or else on iPad it will crash but having the .confirmationDialog inside the lazyVstack leads to unexpected behavior. If you try to click through the cells from 1-10 the .confirmationDialog will stop working after a few taps on the cells. Not sure what the workaround is I'm trying to do something similar in my app with post cells and it's just not working well. I've also noticed that a similar thing happens with .alert if you have it inside the LazyVStack.
struct ContentView: View {
var body: some View {
ScrollView {
LazyVStack {
ForEach(0..<10) { number in
cell(number: number)
}
}
}
}
}
struct cell: View {
@State private var isShowingDialog: Bool = false
let number : Int
var body : some View {
Button {
print("Tapped Cell")
isShowingDialog.toggle()
} label: {
Text("\(number)")
.frame(height: 200)
.frame(maxWidth: .infinity)
.border(.black)
}
.padding(.horizontal, 16)
.confirmationDialog("Options", isPresented: $isShowingDialog, titleVisibility: .visible) {
Button("Some Button", role: .destructive) {
print("Did Tap Option Button")
}
Button("Some Other Button") {
print("Did Tap Other Option Button")
}
}
}
}