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

How do I run an action when dismissing a popover?

Forums > SwiftUI

How can I run an action when I dismiss a popover? I noticed a sheet has the functionality built in with an onDismiss, but it seems to be lacking with a popover. I spent an hour researching it, but the interent can only tell me how to dismiss a popover; nothing about if I can do anything when it does.

Does not include "onDismiss" like a sheet:

func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge = .top, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View

func sheet<Content>(isPresented: Binding<Bool>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View

Thanks, I'd appreicate a quick point in the right direction.

4      

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!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.