Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Strand/Screens/KeyboardDismiss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ private struct TapOutsideFields: UIViewRepresentable {
recognizer = nil
}

/// The recognizer lives on the WINDOW, which outlives this view, so it has to be taken off by
/// hand. `dismantleUIView` and `didMoveToWindow` cover the teardowns SwiftUI tells us about;
/// this covers the ones it does not. A recognizer left behind is quiet rather than harmful
/// (`UIGestureRecognizer` holds its target weakly, so nothing fires) but it accumulates one per
/// appearance, and with the Probe gone its delegate is nil too, so the "ignore text inputs"
/// filter that makes it safe is no longer being applied.
deinit { detach() }

@objc private func tapped() { onTap() }

func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
Expand Down
Loading