diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 6cb427f..58bf04e 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -696,7 +696,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; @@ -731,7 +731,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; 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 {