From 9c1b12810233d8918ad4a90545e9c35a26b74776 Mon Sep 17 00:00:00 2001 From: vasavk Date: Thu, 16 May 2024 17:06:01 +0530 Subject: [PATCH] Showing 3 variations of icons for date indicators for legend --- .../Calendar/CalendarFooterReusableView.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)