So I've got a sheet with a cancel button on the left and a done button on the right, like this:
.navigationBarItems(leading: Button(action: {
// Code that dismisses sheet
}) {
Text("Cancel")
}, trailing: Button(action: {
// Code that adds something to something
}) {
Text("Add").bold()
})
What I want to do is have a block of code execute when my SwiftUI 'sheet' is swiped away (down). This doesn't work with an onDismiss or onDisappear because they both execute on whatever button is pressed AND when it's swiped away.
Is it possible to do this?
