Fixed spelling of focused

This commit is contained in:
dankito 2020-09-02 17:47:42 +02:00
parent 6f510fdaef
commit 841ad7dea5
3 changed files with 19 additions and 19 deletions

View File

@ -25,7 +25,7 @@ struct LabelledUIKitTextField: View {
) )
} }
var isFocussedChanged: ((Bool) -> Void)? = nil var isFocusedChanged: ((Bool) -> Void)? = nil
var isUserInputEnabled: Bool = true var isUserInputEnabled: Bool = true
@ -48,7 +48,7 @@ struct LabelledUIKitTextField: View {
UIKitTextField(placeholder, text: $text, keyboardType: keyboardType, autocapitalizationType: autocapitalizationType, isPasswordField: isPasswordField, UIKitTextField(placeholder, text: $text, keyboardType: keyboardType, autocapitalizationType: autocapitalizationType, isPasswordField: isPasswordField,
focusOnStart: focusOnStart, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, focusTextField: focusTextFieldBinding, focusOnStart: focusOnStart, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, focusTextField: focusTextFieldBinding,
isFocussedChanged: isFocussedChanged, textAlignment: .right, isUserInputEnabled: isUserInputEnabled, isFocusedChanged: isFocusedChanged, textAlignment: .right, isUserInputEnabled: isUserInputEnabled,
actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged) actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged)
} }
} }

View File

@ -18,7 +18,7 @@ struct UIKitTextField: UIViewRepresentable {
private var focusNextTextFieldOnReturnKeyPress = false private var focusNextTextFieldOnReturnKeyPress = false
@Binding private var focusTextField: Bool @Binding private var focusTextField: Bool
private var isFocussedChanged: ((Bool) -> Void)? = nil private var isFocusedChanged: ((Bool) -> Void)? = nil
private var textAlignment: NSTextAlignment = .natural private var textAlignment: NSTextAlignment = .natural
private var isUserInputEnabled: Bool = true private var isUserInputEnabled: Bool = true
@ -30,7 +30,7 @@ struct UIKitTextField: UIViewRepresentable {
init(_ titleKey: String, text: Binding<String>, keyboardType: UIKeyboardType = .default, autocapitalizationType: UITextAutocapitalizationType = .sentences, init(_ titleKey: String, text: Binding<String>, keyboardType: UIKeyboardType = .default, autocapitalizationType: UITextAutocapitalizationType = .sentences,
isPasswordField: Bool = false, focusOnStart: Bool = false, focusNextTextFieldOnReturnKeyPress: Bool = false, focusTextField: Binding<Bool> = .constant(false), isPasswordField: Bool = false, focusOnStart: Bool = false, focusNextTextFieldOnReturnKeyPress: Bool = false, focusTextField: Binding<Bool> = .constant(false),
isFocussedChanged: ((Bool) -> Void)? = nil, isFocusedChanged: ((Bool) -> Void)? = nil,
textAlignment: NSTextAlignment = .natural, isUserInputEnabled: Bool = true, textAlignment: NSTextAlignment = .natural, isUserInputEnabled: Bool = true,
actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) { actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) {
self.placeholder = titleKey self.placeholder = titleKey
@ -43,7 +43,7 @@ struct UIKitTextField: UIViewRepresentable {
self.focusOnStart = focusOnStart self.focusOnStart = focusOnStart
self.focusNextTextFieldOnReturnKeyPress = focusNextTextFieldOnReturnKeyPress self.focusNextTextFieldOnReturnKeyPress = focusNextTextFieldOnReturnKeyPress
self._focusTextField = focusTextField self._focusTextField = focusTextField
self.isFocussedChanged = isFocussedChanged self.isFocusedChanged = isFocusedChanged
self.textAlignment = textAlignment self.textAlignment = textAlignment
self.isUserInputEnabled = isUserInputEnabled self.isUserInputEnabled = isUserInputEnabled
@ -91,7 +91,7 @@ struct UIKitTextField: UIViewRepresentable {
func makeCoordinator() -> UIKitTextField.Coordinator { func makeCoordinator() -> UIKitTextField.Coordinator {
return Coordinator(text: $text, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, isFocussedChanged: isFocussedChanged, return Coordinator(text: $text, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, isFocusedChanged: isFocusedChanged,
isUserInputEnabled: isUserInputEnabled, actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged) isUserInputEnabled: isUserInputEnabled, actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged)
} }
@ -102,7 +102,7 @@ struct UIKitTextField: UIViewRepresentable {
private var focusNextTextFieldOnReturnKeyPress: Bool private var focusNextTextFieldOnReturnKeyPress: Bool
private var isFocussedChanged: ((Bool) -> Void)? = nil private var isFocusedChanged: ((Bool) -> Void)? = nil
private var isUserInputEnabled: Bool private var isUserInputEnabled: Bool
@ -111,12 +111,12 @@ struct UIKitTextField: UIViewRepresentable {
private var textChanged: ((String) -> Void)? private var textChanged: ((String) -> Void)?
init(text: Binding<String>, focusNextTextFieldOnReturnKeyPress: Bool, isFocussedChanged: ((Bool) -> Void)? = nil, isUserInputEnabled: Bool, init(text: Binding<String>, focusNextTextFieldOnReturnKeyPress: Bool, isFocusedChanged: ((Bool) -> Void)? = nil, isUserInputEnabled: Bool,
actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) { actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) {
_text = text _text = text
self.focusNextTextFieldOnReturnKeyPress = focusNextTextFieldOnReturnKeyPress self.focusNextTextFieldOnReturnKeyPress = focusNextTextFieldOnReturnKeyPress
self.isFocussedChanged = isFocussedChanged self.isFocusedChanged = isFocusedChanged
self.isUserInputEnabled = isUserInputEnabled self.isUserInputEnabled = isUserInputEnabled
self.actionOnReturnKeyPress = actionOnReturnKeyPress self.actionOnReturnKeyPress = actionOnReturnKeyPress
@ -128,7 +128,7 @@ struct UIKitTextField: UIViewRepresentable {
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
if isUserInputEnabled { if isUserInputEnabled {
if textField.isFirstResponder { if textField.isFirstResponder {
isFocussedChanged?(true) isFocusedChanged?(true)
} }
} }
@ -136,7 +136,7 @@ struct UIKitTextField: UIViewRepresentable {
} }
func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) { func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {
isFocussedChanged?(false) isFocusedChanged?(false)
} }
func textFieldDidChangeSelection(_ textField: UITextField) { func textFieldDidChangeSelection(_ textField: UITextField) {

View File

@ -115,7 +115,7 @@ struct TransferMoneyDialog: View {
Section { Section {
LabelledUIKitTextField(label: "Remittee Name", text: $remitteeName, focusOnStart: true, focusNextTextFieldOnReturnKeyPress: true, LabelledUIKitTextField(label: "Remittee Name", text: $remitteeName, focusOnStart: true, focusNextTextFieldOnReturnKeyPress: true,
isFocussedChanged: remitteeNameIsFocussedChanged, actionOnReturnKeyPress: handleReturnKeyPress, textChanged: enteredRemitteeNameChanged) isFocusedChanged: remitteeNameisFocusedChanged, actionOnReturnKeyPress: handleReturnKeyPress, textChanged: enteredRemitteeNameChanged)
.padding(.bottom, 0) .padding(.bottom, 0)
remitteeNameValidationResult.map { validationError in remitteeNameValidationResult.map { validationError in
@ -129,8 +129,8 @@ struct TransferMoneyDialog: View {
} }
} }
LabelledUIKitTextField(label: "Remittee IBAN", text: $remitteeIban, autocapitalizationType: .allCharacters, focusNextTextFieldOnReturnKeyPress: true, isFocussedChanged: validateRemitteeIbanOnFocusLost, LabelledUIKitTextField(label: "Remittee IBAN", text: $remitteeIban, autocapitalizationType: .allCharacters, focusNextTextFieldOnReturnKeyPress: true, isFocusedChanged: validateRemitteeIbanOnFocusLost,
actionOnReturnKeyPress: handleReturnKeyPress, textChanged: remitteeIbanIsFocussedChanged) actionOnReturnKeyPress: handleReturnKeyPress, textChanged: remitteeIbanisFocusedChanged)
remitteeIbanValidationResult.map { validationError in remitteeIbanValidationResult.map { validationError in
ValidationLabel(validationError) ValidationLabel(validationError)
@ -216,8 +216,8 @@ struct TransferMoneyDialog: View {
} }
private func remitteeNameIsFocussedChanged(_ isFocussed: Bool) { private func remitteeNameisFocusedChanged(_ isFocused: Bool) {
if isFocussed == false { if isFocused == false {
validateRemitteeNameOnFocusLost() validateRemitteeNameOnFocusLost()
self.showRemitteeAutocompleteList = false self.showRemitteeAutocompleteList = false
@ -261,14 +261,14 @@ struct TransferMoneyDialog: View {
} }
private func remitteeIbanIsFocussedChanged(_ enteredIban: String) { private func remitteeIbanisFocusedChanged(_ enteredIban: String) {
validateField($remitteeIban, $remitteeIbanValidationResult, $isValidRemitteeIbanEntered) { inputValidator.validateIbanWhileTyping(ibanToTest: enteredIban) } validateField($remitteeIban, $remitteeIbanValidationResult, $isValidRemitteeIbanEntered) { inputValidator.validateIbanWhileTyping(ibanToTest: enteredIban) }
tryToGetBicFromIban(enteredIban) tryToGetBicFromIban(enteredIban)
} }
private func validateRemitteeIbanOnFocusLost(_ isFocussed: Bool) { private func validateRemitteeIbanOnFocusLost(_ isFocused: Bool) {
if isFocussed == false { if isFocused == false {
validateRemitteeIbanOnFocusLost() validateRemitteeIbanOnFocusLost()
} }
} }