From 89499d59edb2ee10848de00e54de3103b0923fa3 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 5 May 2020 12:54:50 -0400 Subject: [PATCH] indicator changes --- .../Views/CarouselIndicator/BarsIndicatorView.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift index 9b4ea3bc..ad65049d 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CarouselIndicator/BarsIndicatorView.swift @@ -42,19 +42,24 @@ open class BarsIndicatorView: CarouselIndicator { open override var isEnabled: Bool { didSet { - barReferences.forEach { view, _ in - view.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor + + for (i, bar) in barReferences.enumerated() { + if i == currentIndex { + bar.view.backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor + } else { + bar.view.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor + } } } } /// Colors the currently selected index, unique from other indicators public var currentIndicatorColor: UIColor { - get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? .mvmBlack } + get { return barsCarouselIndicatorModel?.currentIndicatorColor.uiColor ?? indicatorColor } set (newColor) { barsCarouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor) - if !barReferences.isEmpty { + if isEnabled && !barReferences.isEmpty { barReferences[currentIndex].view.backgroundColor = newColor } }