diff --git a/VDS/Components/TextFields/EntryField/EntryField.swift b/VDS/Components/TextFields/EntryField/EntryField.swift index 3cc7fc4a..b5f6193e 100644 --- a/VDS/Components/TextFields/EntryField/EntryField.swift +++ b/VDS/Components/TextFields/EntryField/EntryField.swift @@ -93,7 +93,7 @@ open class EntryField: Control, Accessable { // MARK: - Configuration Properties //-------------------------------------------------- // Sizes are from InVision design specs. - internal let containerSize = CGSize(width: 45, height: 44) + internal var containerSize: CGSize { CGSize(width: 45, height: 44) } internal let primaryColorConfig = ViewColorConfiguration().with { $0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forDisabled: true) diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index d3cb99e0..e4e84be1 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -16,7 +16,7 @@ public enum InputFieldType: String, CaseIterable { } @objc(VDSInputField) -public class InputField: EntryField { +public class InputField: EntryField, UITextFieldDelegate { //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -102,7 +102,6 @@ public class InputField: EntryField { $0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forDisabled: false) }.eraseToAnyColorable() - internal var minWidthConstraint: NSLayoutConstraint? //-------------------------------------------------- @@ -117,6 +116,13 @@ public class InputField: EntryField { controlContainerView.addSubview(textField) textField.pinToSuperView() textField.heightAnchor.constraint(equalToConstant: 20).isActive = true + textField + .textPublisher + .sink { [weak self] text in + self?.value = text + self?.sendActions(for: .valueChanged) + + }.store(in: &subscribers) stackView.addArrangedSubview(successLabel) stackView.setCustomSpacing(8, after: successLabel) @@ -130,6 +136,9 @@ public class InputField: EntryField { public override func reset() { super.reset() + textField.text = "" + textField.delegate = self + successLabel.reset() successLabel.textPosition = .left successLabel.typograpicalStyle = .BodySmall @@ -204,6 +213,7 @@ public class InputField: EntryField { } } } + } extension InputFieldType {