diff --git a/VDS/Components/Calendar/CalendarFooterReusableView.swift b/VDS/Components/Calendar/CalendarFooterReusableView.swift index f8432bda..1a402dc3 100644 --- a/VDS/Components/Calendar/CalendarFooterReusableView.swift +++ b/VDS/Components/Calendar/CalendarFooterReusableView.swift @@ -40,7 +40,9 @@ class CalendarFooterReusableView: UICollectionReusableView { $0.backgroundColor = .clear $0.delegate = self $0.dataSource = self - $0.register(LegendCollectionViewCell.self, forCellWithReuseIdentifier: LegendCollectionViewCell.identifier) + + $0.register(LegendCollectionViewCell.self, + forCellWithReuseIdentifier: LegendCollectionViewCell.identifier) } //-------------------------------------------------- @@ -160,7 +162,11 @@ private class LegendCollectionViewCell: UICollectionViewCell { func setupCell() { addSubview(stackView) stackView.pinToSuperView() - + } + + func updateView() { + stackView.arrangedSubviews.forEach { $0.removeFromSuperview() } + legendIndicator.layer.sublayers?.forEach { $0.removeFromSuperlayer() } legendIndicatorWrapper.addSubview(legendIndicator) legendIndicator.pinLeading().pinTrailing().width(8).height(8).pinCenterY() @@ -169,6 +175,7 @@ private class LegendCollectionViewCell: UICollectionViewCell { } func updateTitle(text: String, color: UIColor, surface: Surface, clearFullcircle: Bool, drawSemiCircle: Bool) { + updateView() title.surface = surface title.text = text title.textColor = textColorConfiguration.getColor(surface)