Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-15 12:11:23 -05:00
parent 166ecf461d
commit f3b9999e34
2 changed files with 13 additions and 9 deletions

View File

@ -135,7 +135,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, ViewProt
font = FontStyle.defaultStyle.font
}
if let attributes = viewModel.attributes, let text = model.text, let font = font, let textColor = textColor {
if let attributes = viewModel.attributes, let text = viewModel.text, let font = font, let textColor = textColor {
//clear the arrays holding actions
accessibilityCustomActions = []
actions = []

View File

@ -87,17 +87,21 @@ open class SelectorGroupBase<SelectorType, SelectorGroupType: SelectorGroupModel
let newSelectorView = SelectorHandlerType(with: selectorModel)
//add the selectedPublisher for the change
newSelectorView.selectedPublisher().sink { [weak self] model in
guard self?.model.selectors.count ?? 0 > 0 else { return }
self?.didSelect(selector: model)
}.store(in: &subscribers)
newSelectorView.selectedPublisher()
.sink { [weak self] model in
guard self?.model.selectors.count ?? 0 > 0 else { return }
self?.didSelect(selector: model)
}
.store(in: &subscribers)
//add model update to the subscribers
newSelectorView.modelPublisher.debounce(for: .seconds(Constants.ModelStateDebounce), scheduler: RunLoop.main).sink { [weak self] model in
if let cached = self?.getCachedSelector(viewModel: model), newSelectorView.shouldUpdateView(viewModel: cached) {
self?.replace(viewModel: model)
newSelectorView.handlerPublisher()
.sink { [weak self] model in
if let cached = self?.getCachedSelector(viewModel: model), newSelectorView.shouldUpdateView(viewModel: cached) {
self?.replace(viewModel: model)
}
}
}.store(in: &subscribers)
.store(in: &subscribers)
self.selectorViews.append(newSelectorView)
mainStackView.addArrangedSubview(newSelectorView)