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 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 //clear the arrays holding actions
accessibilityCustomActions = [] accessibilityCustomActions = []
actions = [] actions = []

View File

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