identity and callback.
This commit is contained in:
parent
dc8293b08b
commit
cfffbabe58
@ -275,7 +275,7 @@ import UIKit
|
||||
var selectPreviousField = false
|
||||
|
||||
for (index, box) in Array(digitBoxes.reversed()).enumerated() {
|
||||
if box.digitField == currentTextField {
|
||||
if box.digitField === currentTextField {
|
||||
if index == digitBoxes.count - 1 {
|
||||
return
|
||||
} else {
|
||||
@ -298,7 +298,7 @@ import UIKit
|
||||
var selectNextField = false
|
||||
|
||||
for (index, box) in digitBoxes.enumerated() {
|
||||
if box.digitField == currentTextField {
|
||||
if box.digitField === currentTextField {
|
||||
if index == digitBoxes.count - 1 {
|
||||
return
|
||||
} else {
|
||||
@ -404,7 +404,7 @@ extension DigitEntryField {
|
||||
}
|
||||
|
||||
digitBoxes.forEach {
|
||||
if $0.digitField == textField {
|
||||
if $0.digitField === textField {
|
||||
selectedDigitBox = $0
|
||||
$0.isSelected = true
|
||||
return
|
||||
@ -417,7 +417,7 @@ extension DigitEntryField {
|
||||
@objc public func textFieldDidEndEditing(_ textField: UITextField) {
|
||||
|
||||
digitBoxes.forEach {
|
||||
if $0.digitField == textField {
|
||||
if $0.digitField === textField {
|
||||
selectedDigitBox = nil
|
||||
$0.isSelected = false
|
||||
return
|
||||
|
||||
@ -22,6 +22,8 @@ open class ItemDropdownEntryField: BaseDropdownEntryField {
|
||||
/// When selecting for first responder, allow initial selected value to appear in empty text field.
|
||||
public var setInitialValueInTextField = true
|
||||
|
||||
public var observeDropdownChange: ((String)->())?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
@ -64,6 +66,8 @@ open class ItemDropdownEntryField: BaseDropdownEntryField {
|
||||
|
||||
@objc private func setInitialValueFromPicker() {
|
||||
|
||||
guard !pickerData.isEmpty else { return }
|
||||
|
||||
if setInitialValueInTextField, let pickerIndex = pickerView?.selectedRow(inComponent: 0) {
|
||||
text = pickerData[pickerIndex]
|
||||
}
|
||||
@ -74,6 +78,16 @@ open class ItemDropdownEntryField: BaseDropdownEntryField {
|
||||
|
||||
setInitialValueFromPicker()
|
||||
}
|
||||
|
||||
@objc override func endInputing() {
|
||||
super.endInputing()
|
||||
|
||||
guard !pickerData.isEmpty else { return }
|
||||
|
||||
if let pickerIndex = pickerView?.selectedRow(inComponent: 0) {
|
||||
observeDropdownChange?(pickerData[pickerIndex])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK:- Base Picker Delegate
|
||||
|
||||
@ -89,11 +89,7 @@ import UIKit
|
||||
// MARK: - Property Observers
|
||||
//--------------------------------------------------
|
||||
|
||||
public var validationBlock: ((_ value: String?) -> Bool)? {
|
||||
didSet { //valueChanged()
|
||||
|
||||
}
|
||||
}
|
||||
public var validationBlock: ((_ value: String?) -> Bool)?
|
||||
|
||||
public override var errorMessage: String? {
|
||||
didSet {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user