moved valueChanged to method
again this is due to the updating internal models via the control, therefore there will be a delay in the eventing from the publisher back up to the parent model Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
9b22fb4e2f
commit
77a02a1e25
@ -88,6 +88,11 @@ public class SelectorGroupHandlerBase<GroupModelType: SelectorGroupModelable, Mo
|
||||
fatalError("Must override didSelect")
|
||||
}
|
||||
|
||||
public func valueChanged() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectorGroupSelectedHandlerBase<GroupModelType: SelectorGroupSelectedModelable, ModelHandlerType: Control<GroupModelType.SelectorModelType>>: SelectorGroupHandlerBase<GroupModelType, ModelHandlerType> where GroupModelType.SelectorModelType == ModelHandlerType.ModelType {
|
||||
|
||||
@ -14,9 +14,7 @@ public class CheckboxGroup: CheckboxGroupBase<DefaultCheckboxGroupModel, Checkbo
|
||||
if selectedControl.isSelected, hasError{
|
||||
hasError.toggle()
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
valueChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,9 +14,7 @@ public class RadioBoxGroup: RadioBoxGroupBase<DefaultRadioBoxGroupModel, RadioBo
|
||||
let oldSelectedControl = selectorViews.filter { $0.isSelected == true }.first
|
||||
oldSelectedControl?.toggle()
|
||||
selectedControl.toggle()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
valueChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,9 +17,7 @@ public class RadioButtonGroup: RadioButtonGroupBase<DefaultRadioButtonGroupModel
|
||||
if hasError {
|
||||
hasError = false
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
valueChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,9 +18,7 @@ public class RadioSwatchGroup: RadioSwatchGroupBase<DefaultRadioSwatchGroupModel
|
||||
}
|
||||
selector.toggle()
|
||||
label.text = selector.model.text
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
valueChanged()
|
||||
}
|
||||
|
||||
}
|
||||
@ -226,6 +224,12 @@ public class RadioSwatchGroupBase<GroupModelType: RadioSwatchGroupModel, ModelHa
|
||||
fatalError("Must override didSelect")
|
||||
}
|
||||
|
||||
public func valueChanged() {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + Constants.ModelStateDebounce) { [weak self] in
|
||||
self?.sendActions(for: .valueChanged)
|
||||
}
|
||||
}
|
||||
|
||||
public var selectedModelHandler: ModelHandlerType? {
|
||||
guard let index = model.selectors.firstIndex(where: {$0.selected == true }),
|
||||
let cell = collectionView.cellForItem(at: IndexPath(item: index, section: 0)) as? CollectionViewCell<ModelHandlerType> else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user