Heestand XYZ
Heestand XYZ

Reputation: 2221

SwiftUI Popover dismissHandler not called

This is my setup:

struct ControlView : View {
    let control: Control
    @State var showingPopover = false
    var body: some View {
        HStack {
            Text(control.name)
            Spacer()
            ControlKindView(control: control)
                .frame(width: 250)
            Image(systemName: "info.circle")
                .foregroundColor(.accentColor)
                .tapAction {
                    self.showingPopover = true
                }
                .presentation(showingPopover ?
                    Popover(content: ControlInfoView(control: control),
                        dismissHandler: {
                            self.showingPopover = false
                        }
                    )
                : nil)
        }
    }
}

I've set breakpoints at self.showingPopover = <bool>, the first is called and shows the popover, tho the dismissHandler is not called when swiping the popover away, thereby a second tap on the image won't show the popover.

Any idea how to detect a popover swipe away? Or should I set this up differently?

Upvotes: 0

Views: 757

Answers (1)

kontiki
kontiki

Reputation: 40509

Popover has been deprecated in beta 3. I suggest you upgrade. Changes are the problem is gone.

Best case scenario, the question is no longer relevant.

Upvotes: 1

Related Questions