From 38da43988866188e977f46fc7f4101f0152b3a90 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 3 Aug 2020 20:21:49 +0200 Subject: [PATCH] Removed unused (unusable) focus() and clearFocus() --- .../BankingiOSApp/ui/UIKitTextField.swift | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/UIKitTextField.swift b/ui/BankingiOSApp/BankingiOSApp/ui/UIKitTextField.swift index 76618c53..43ccc9c5 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/UIKitTextField.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/UIKitTextField.swift @@ -20,9 +20,6 @@ struct UIKitTextField: UIViewRepresentable { private var textChanged: ((String) -> Void)? = nil - @State private var textField: UITextField? = nil - - init(_ titleKey: String, text: Binding, keyboardType: UIKeyboardType = .default, isPasswordField: Bool = false, focusOnStart: Bool = false, focusNextTextFieldOnReturnKeyPress: Bool = false, actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) { self.placeHolder = titleKey @@ -53,10 +50,6 @@ struct UIKitTextField: UIViewRepresentable { Self.NextTagId = Self.NextTagId + 1 // unbelievable, there's no ++ operator textField.tag = Self.NextTagId - DispatchQueue.main.async { // to not update state on view updates (and i only need @State as structs cannot be modified) - self.textField = textField - } - if focusOnStart { textField.becomeFirstResponder() } @@ -72,15 +65,6 @@ struct UIKitTextField: UIViewRepresentable { func makeCoordinator() -> UIKitTextField.Coordinator { return Coordinator(text: $text, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged) } - - - func focus() -> Bool { - return textField?.becomeFirstResponder() ?? false - } - - func clearFocus() -> Bool { - return textField?.resignFirstResponder() ?? false - } class Coordinator: NSObject, UITextFieldDelegate {