diff --git a/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift b/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift index 600af64c..e083eadc 100644 --- a/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift @@ -126,5 +126,7 @@ extension DateDropdownEntryField { super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) guard let dictionary = json, !dictionary.isEmpty else { return } + + } } diff --git a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift b/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift index f8a2ccbf..b352a89b 100644 --- a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift @@ -306,10 +306,10 @@ import UIKit return enabledTextFields } - - //-------------------------------------------------- - // MARK: - Text Field Delegate - //-------------------------------------------------- +} + +// MARK: - TextField Delegate +extension DigitEntryField { @objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool { @@ -381,10 +381,6 @@ import UIKit return uiTextFieldDelegate?.textFieldShouldClear?(textField) ?? true } - //-------------------------------------------------- - // MARK: - Passed Along TextField delegate - //-------------------------------------------------- - @objc public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { return uiTextFieldDelegate?.textFieldShouldBeginEditing?(textField) ?? true diff --git a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift b/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift index 63162cd8..f77dcf78 100644 --- a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift @@ -42,10 +42,20 @@ open class ItemDropdownEntryField: DropdownEntryField { // MARK: - Initializer //-------------------------------------------------- + public convenience init() { + self.init(frame: .zero) + setup() + } + public convenience init(pickerData: [String]) { self.init(frame: .zero) self.pickerData = pickerData + setup() + } + + private func setup() { + pickerView = MVMCoreUICommonViewsUtility.addPicker(to: textField, delegate: self) textField.hideBlinkingCaret = true uiTextFieldDelegate = self @@ -102,6 +112,10 @@ extension ItemDropdownEntryField { super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) guard let dictionary = json, !dictionary.isEmpty else { return } + + if let options = dictionary["options"] as? [String] { + pickerData = options + } } }