From 43ec6d0671019bde6e869c97182fc92fa54d4855 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 11:16:36 -0500 Subject: [PATCH 1/2] added check for dismiss first responder Signed-off-by: Matt Bruce --- .../ViewControllers/BaseViewController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/VDSSample/ViewControllers/BaseViewController.swift b/VDSSample/ViewControllers/BaseViewController.swift index 3c31212..46526d9 100644 --- a/VDSSample/ViewControllers/BaseViewController.swift +++ b/VDSSample/ViewControllers/BaseViewController.swift @@ -261,6 +261,21 @@ public class BaseViewController: UIViewController, Initable , loadCustomRotors() UIAccessibility.post(notification: .screenChanged, argument: component) } + + if component.canBecomeFirstResponder { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) + tapGesture.cancelsTouchesInView = false // This allows the tap to pass through to other views. + view.addGestureRecognizer(tapGesture) + } + } + + @objc func dismissKeyboard(_ sender: UITapGestureRecognizer) { + let location = sender.location(in: self.view) + + // Check if the touch is outside the textView + if !component.frame.contains(location) { + component.resignFirstResponder() + } } func isViewHiddenByKeyboard(view: UIView, keyboardFrame: CGRect) -> Bool { From 05d2e448d3955c906f2c9475474c93d68bed1be4 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Apr 2024 13:07:33 -0500 Subject: [PATCH 2/2] updated version Signed-off-by: Matt Bruce --- VDSSample.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index fc9f459..c6ad2b1 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -692,7 +692,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 60; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES; @@ -727,7 +727,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 59; + CURRENT_PROJECT_VERSION = 60; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = FCMA4QKS77; GENERATE_INFOPLIST_FILE = YES;