commit a1e620f72109914ed12baca7860f9864a41a1182 parent c122035851be18b1329bab3f497a1794e97ac0ed Author: William Casarin <jb55@jb55.com> Date: Sat, 2 Jul 2022 12:30:58 -0700 refactor: generalize end_editing might be useful... we shall see Signed-off-by: William Casarin <jb55@jb55.com> Diffstat:
M | damus/Util/InputDismissKeyboard.swift | | | 21 | +++++++++++---------- |
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/damus/Util/InputDismissKeyboard.swift b/damus/Util/InputDismissKeyboard.swift @@ -24,16 +24,17 @@ public struct DismissKeyboardOnTap: ViewModifier { } private var tapGesture: some Gesture { - TapGesture().onEnded(endEditing) + TapGesture().onEnded(end_editing) } - private func endEditing() { - UIApplication.shared.connectedScenes - .filter {$0.activationState == .foregroundActive} - .map {$0 as? UIWindowScene} - .compactMap({$0}) - .first?.windows - .filter {$0.isKeyWindow} - .first?.endEditing(true) - } +} + +func end_editing() { + UIApplication.shared.connectedScenes + .filter {$0.activationState == .foregroundActive} + .map {$0 as? UIWindowScene} + .compactMap({$0}) + .first?.windows + .filter {$0.isKeyWindow} + .first?.endEditing(true) }