From c5cf11e8fc6bb42a50fd889eeefc045e3f3cead8 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 5 Nov 2020 00:53:43 +0100 Subject: [PATCH] Implemented that on tap on label also password visibility gets toggled --- ui/BankingiOSApp/BankingiOSApp/ui/UIKit/UIKitTextField.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/UIKitTextField.swift b/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/UIKitTextField.swift index a598738f..c651e989 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/UIKitTextField.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/UIKitTextField.swift @@ -101,6 +101,10 @@ struct UIKitTextField: UIViewRepresentable { if focusTextField { DispatchQueue.main.async { // in very few cases focusTextField gets called during view update resulting in 'undefined behavior' -> async() fixes this uiView.focus() + + if isPasswordField { // TODO: currently it works but focusTextField can in general also be set in other ways then by tapping on label + context.coordinator.togglePasswordVisibility() + } DispatchQueue.main.async { self.focusTextField = false // reset value so that it can be set again (otherwise it may never gets resetted and then updateUIView() requests focus even though already another view got the focus in the meantime)