TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Intercepting swipe-dismiss of a modal sheet

Forums > SwiftUI

I know how to prevent using swipe to dismiss a modal sheet with .interactiveDismissDisabled(), and I know how to programmatically dismiss a sheet with the dismiss action.

But what I really want is to intercept the user swipe to present a confirmation dialog if they've made edits that need to be saved.

You can experience this in the iOS Calendar app: Go to create a new calendar entry, set the title, and then swipe to dismiss the sheet. It starts to animate down before springing back up as a confirmation alert appears.

Is this even possible in SwiftUI? All my googling just turns up the above two issues.

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.