I'm trying to have a button which when pressed animates into anther button to press again to confirm. I would like to be able to dismiss this then (and revert to the original button) by touching anywhere outside the new button. (eg anywhere on the screen).
I thought I could archive this by placing a (transparent) absolute overlay on the entire screen. (I know I can do this if my dismisser is the outer most view, but that is not what I want, since I would like to make this a simple drop in component eg a DismissableButton or something.)
So basically I'm looking for something like CSS's fixed position.
How can I achieve this? This (simplified is basically my current setup)
var body: some View {
return Group {
if (!self.showConfirmation) {
self.initialButton
} else {
ZStack {
self.dismisser // So I thought either position this absolute in regards to the screen with full height and width
self.confirmButton // Or if there's some way to attach an gesture recogniser that registers touches outside of it
}
}
}
}