From 65cd734a403512a7770b2521520d64a4a0fec400 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 2 Apr 2020 10:45:42 -0400 Subject: [PATCH] removed duplicate file --- .../BarsCarouselIndicatorModel.swift | 49 ---- .../CarouselIndicator/BarsIndicatorView.swift | 172 ------------- .../CarouselIndicator/CarouselIndicator.swift | 235 ------------------ .../CarouselIndicatorModel.swift | 126 ---------- .../NumericCarouselIndicatorModel.swift | 19 -- .../NumericIndicatorView.swift | 131 ---------- 6 files changed, 732 deletions(-) delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsCarouselIndicatorModel.swift delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsIndicatorView.swift delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicator.swift delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicatorModel.swift delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericCarouselIndicatorModel.swift delete mode 100644 MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericIndicatorView.swift diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsCarouselIndicatorModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsCarouselIndicatorModel.swift deleted file mode 100644 index 89369987..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsCarouselIndicatorModel.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// BarsCarouselIndicatorModel.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 3/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - - -open class BarsCarouselIndicatorModel: CarouselIndicatorModel { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public class override var identifier: String { - return "barsCarouselIndicator" - } - - public var currentIndicatorColor: Color = Color(uiColor: .mvmBlack) - - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case currentIndicatorColor - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - public required init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - - if let currentIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .currentIndicatorColor) { - self.currentIndicatorColor = currentIndicatorColor - } - - try super.init(from: decoder) - } - - public override func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(currentIndicatorColor, forKey: .currentIndicatorColor) - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsIndicatorView.swift deleted file mode 100644 index 5724a76e..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/BarsIndicatorView.swift +++ /dev/null @@ -1,172 +0,0 @@ -// -// BarIndicatorView.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 2/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - - -open class BarsIndicatorView: CarouselIndicator { - //-------------------------------------------------- - // MARK: - Stored Properties - //-------------------------------------------------- - - public let stackView: StackView = { - let stackView = StackView() - stackView.axis = .horizontal - stackView.alignment = .bottom - stackView.distribution = .equalSpacing - stackView.spacing = 6 - stackView.heightAnchor.constraint(lessThanOrEqualToConstant: BarsIndicatorView.indicatorBarHeight.selected).isActive = true - return stackView - }() - - public var barReferences: [(view: View, constraint: NSLayoutConstraint)] = [] - - // Dimensions are based on InVision Design Guidelines. - public static let indicatorBarWidth: CGFloat = 24 - public static let indicatorBarHeight: (selected: CGFloat, unselected: CGFloat) = (selected: 4, unselected: 1) - - /// Convenience to access the model. - public var barsCarouselIndicatorModel: BarsCarouselIndicatorModel? { - return model as? BarsCarouselIndicatorModel - } - - //-------------------------------------------------- - // MARK: - Computed Properties - //-------------------------------------------------- - - open override var isEnabled: Bool { - didSet { - barReferences.forEach { view, _ in - view.backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor - } - } - } - - private(set) var _currentIndicatorColor: UIColor = .black - - /// Colors the currently selected index, unique from other indicators - public var currentIndicatorColor: UIColor { - get { return _currentIndicatorColor } - set (newColor) { - _currentIndicatorColor = newColor - barsCarouselIndicatorModel?.currentIndicatorColor = Color(uiColor: newColor) - - if !barReferences.isEmpty { - barReferences[currentIndex].view.backgroundColor = newColor - } - } - } - - public override var indicatorColor: UIColor { - get { return _indicatorColor } - set (newColor) { - super.indicatorColor = newColor - - for (i, barTuple) in barReferences.enumerated() where i != currentIndex { - barTuple.view.backgroundColor = newColor - } - } - } - - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- - - public init() { - super.init(frame: .zero) - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - //-------------------------------------------------- - // MARK: - Setup - //-------------------------------------------------- - - open override func setupView() { - super.setupView() - - addSubview(stackView) - isUserInteractionEnabled = false - - NSLayoutConstraint.activate([ - stackView.heightAnchor.constraint(equalToConstant: 4), - heightAnchor.constraint(equalTo: stackView.heightAnchor), - stackView.centerXAnchor.constraint(equalTo: centerXAnchor), - stackView.leadingAnchor.constraint(equalTo: leadingAnchor), - stackView.topAnchor.constraint(equalTo: topAnchor), - bottomAnchor.constraint(equalTo: stackView.bottomAnchor), - trailingAnchor.constraint(equalTo: stackView.trailingAnchor) - ]) - } - - //-------------------------------------------------- - // MARK: - Methods - //-------------------------------------------------- - - func generateBars() { - - var bars = [(View, NSLayoutConstraint)]() - - for i in 0..= touchPoint_X && $0.0.frame.minX <= touchPoint_X } ?? 0 - } - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - super.set(with: model, delegateObject, additionalData) - - guard let model = model as? BarsCarouselIndicatorModel else { return } - - currentIndicatorColor = model.currentIndicatorColor.uiColor - } - - //-------------------------------------------------- - // MARK: - IndicatorViewProtocol - //-------------------------------------------------- - - public override func reset() { - super.reset() - barReferences.forEach { $0.view.removeFromSuperview() } - barReferences = [] - } - - public override func updateUI(previousIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) { - - guard !barReferences.isEmpty else { - generateBars() - return - } - - let expression = { - self.barReferences[previousIndex].view.backgroundColor = self.indicatorColor - self.barReferences[newIndex].view.backgroundColor = self.currentIndicatorColor - self.barReferences[previousIndex].constraint.constant = BarsIndicatorView.indicatorBarHeight.unselected - self.barReferences[newIndex].constraint.constant = BarsIndicatorView.indicatorBarHeight.selected - self.layoutIfNeeded() - } - - isAnimated ? UIView.animate(withDuration: 0.3) { expression() } : expression() - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicator.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicator.swift deleted file mode 100644 index 1e4db496..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicator.swift +++ /dev/null @@ -1,235 +0,0 @@ -// -// CarouselIndicator.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 1/30/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - - -open class CarouselIndicator: Control, CarouselPageControlProtocol { - //-------------------------------------------------- - // MARK: - Constraints - //-------------------------------------------------- - - public var topConstraint: NSLayoutConstraint? - public var bottomConstraint: NSLayoutConstraint? - - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public var uiGestures: Set = [] - - /// Convenience to access the model. - public var carouselIndicatorModel: CarouselIndicatorModel? { - return model as? CarouselIndicatorModel - } - - /// Set this closure to perform an action when a different indicator was selected. - /// Passes through oldInde and newIndex, respectively. - public var indicatorTouchAction: ((CarouselPageControlProtocol) -> ())? - - open override var isEnabled: Bool { - didSet { - isUserInteractionEnabled = isEnabled - } - } - - //-------------------------------------------------- - // MARK: - Computed Properties - //-------------------------------------------------- - - private(set) var previousIndex = 0 - private var _currentIndex = 0 - - public var currentIndex: Int { - get { return _currentIndex } - set (newIndex) { - carouselIndicatorModel?.currentIndex = newIndex - previousIndex = _currentIndex - _currentIndex = newIndex - performAction() - if previousIndex != newIndex { - updateUI(previousIndex: previousIndex, newIndex: newIndex, totalCount: numberOfPages, isAnimated: carouselIndicatorModel?.isAnimated ?? true) - } - } - } - - private var _numberOfPages = 0 - - /// Holds the total number of pages displayed by the carousel. - /// Updating this property will potentially update the UI. - public var numberOfPages: Int { - get { return _numberOfPages } - set (newTotal) { - guard _numberOfPages != newTotal else { return } - carouselIndicatorModel?.numberOfPages = newTotal - _numberOfPages = newTotal - - isHidden = carouselIndicatorModel?.hidesForSinglePage ?? false && newTotal <= 1 - updateUI(previousIndex: previousIndex, newIndex: currentIndex, totalCount: newTotal, isAnimated: carouselIndicatorModel?.isAnimated ?? true) - } - } - - public var disabledIndicatorColor: UIColor { - return carouselIndicatorModel?.disabledIndicatorColor.uiColor ?? .mvmCoolGray3 - } - - private(set) var _indicatorColor: UIColor = .black - - public var indicatorColor: UIColor { - get { return _indicatorColor } - set (newColor) { - carouselIndicatorModel?.indicatorColor = Color(uiColor: newColor) - } - } - - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- - - override init(frame: CGRect) { - super.init(frame: frame) - } - - convenience override init() { - self.init(frame: .zero) - } - - required public init?(coder: NSCoder) { - super.init(coder: coder) - } - - //-------------------------------------------------- - // MARK: - Lifecycle - //-------------------------------------------------- - - public override func initialSetup() { - super.initialSetup() - - isAccessibilityElement = true - accessibilityTraits = .adjustable - } - - open override func setupView() { - super.setupView() - - setupGestures() - } - - //-------------------------------------------------- - // MARK: - UITouch - //-------------------------------------------------- - - private func setupGestures() { - - let tap = UITapGestureRecognizer(target: self, action: #selector(indicatorTapped)) - let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeLeft)) - let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(swipeRight)) - - leftSwipe.direction = .left - rightSwipe.direction = .right - - addGestureRecognizer(tap) - addGestureRecognizer(leftSwipe) - addGestureRecognizer(rightSwipe) - - uiGestures.insert(tap) - uiGestures.insert(leftSwipe) - uiGestures.insert(rightSwipe) - } - - func incrementCurrentIndex() { - currentIndex = min(currentIndex + 1, numberOfPages - 1) - } - - func decrementCurrentIndex() { - currentIndex = max(0, currentIndex - 1) - } - - /// Increments the currentIndex value. - @objc func swipeLeft() { - incrementCurrentIndex() - } - - /// Decrement the currentIndex value - @objc func swipeRight() { - decrementCurrentIndex() - } - - /// Handles tap logic for Indicator - @objc func indicatorTapped(_ tapGesture: UITapGestureRecognizer?) { - - let touchPoint = tapGesture?.location(in: self) - let touchPoint_X = touchPoint?.x ?? 0.0 - - assessTouchOf(touchPoint_X) - } - - func assessTouchOf(_ touchPoint_X: CGFloat) { } - - //-------------------------------------------------- - // MARK: - Methods - //-------------------------------------------------- - - open func updateUI(previousIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) { } - - public func performAction() { - - sendActions(for: .valueChanged) - indicatorTouchAction?(self) - } - - public func scrollViewDidScroll(_ collectionView: UICollectionView) { } - - //-------------------------------------------------- - // MARK: - MoleculeViewProtocol - //-------------------------------------------------- - - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - super.set(with: model, delegateObject, additionalData) - - guard let model = model as? CarouselIndicatorModel else { return } - - indicatorColor = model.indicatorColor.uiColor - currentIndex = model.currentIndex - isEnabled = model.isEnabled - - if let accessibleValue = MVMCoreUIUtility.hardcodedString(withKey: model.accessibilityHasSlidesInsteadOfPage ? "MVMCoreUIPageControlslides_currentpage_index" : "MVMCoreUIPageControl_currentpage_index") { - accessibilityValue = String(format: accessibleValue, currentIndex + 1, numberOfPages) - } - } - - //-------------------------------------------------- - // MARK: - Accessibility - //-------------------------------------------------- - - open override func accessibilityIncrement() { - - accessibilityAdjust(toPage: currentIndex + 1) - } - - open override func accessibilityDecrement() { - - accessibilityAdjust(toPage: currentIndex - 1) - } - - func accessibilityAdjust(toPage index: Int) { - - if (index < numberOfPages && index >= 0) || carouselIndicatorModel?.alwaysSendAction ?? false { - carouselIndicatorModel?.isAnimated = false - previousIndex = currentIndex - currentIndex = index - performAction() - } - } - - func setTopBottomSpace(constant: CGFloat) { - - bottomConstraint?.constant = constant - topConstraint?.constant = constant - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicatorModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicatorModel.swift deleted file mode 100644 index 75e5ed58..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/CarouselIndicatorModel.swift +++ /dev/null @@ -1,126 +0,0 @@ -// -// CarouselIndicatorModel.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 2/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - - -open class CarouselIndicatorModel: CarouselPagingModelProtocol { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public class var identifier: String { - return "" - } - - public var backgroundColor: Color? - public var moleculeName: String? - - /// The maxmum count of pages before the indicatorView forces a Numeric Indicator in place of Bar. - public var numberOfPages: Int = 0 - - // Sets the current Index to focus on. - public var currentIndex: Int = 0 - public var isAnimated: Bool = true - public var hidesForSinglePage: Bool = false - /// Set true to make the accessibility value as "Slide #currentPage of #totalPage", otherwise will be "Page #currentPage of #totalPage", default is false - public var accessibilityHasSlidesInsteadOfPage: Bool = false - public var isEnabled: Bool = true - public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3) - public var indicatorColor: Color = Color(uiColor: .mvmBlack) - public var position: Float? - - /// Allows sendActions() to trigger even if index is already at min/max index. - public var alwaysSendAction = false - - //-------------------------------------------------- - // MARK: - Keys - //-------------------------------------------------- - - private enum CodingKeys: String, CodingKey { - case moleculeName - case backgroundColor - case currentIndex - case numberOfPages - case alwaysSendAction - case isAnimated - case hidesForSinglePage - case accessibilityHasSlidesInsteadOfPage - case isEnabled - case disabledIndicatorColor - case indicatorColor - case currentIndicatorColor - case position - } - - //-------------------------------------------------- - // MARK: - Codec - //-------------------------------------------------- - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - - if let numberOfPages = try typeContainer.decodeIfPresent(Int.self, forKey: .numberOfPages) { - self.numberOfPages = numberOfPages - } - - if let currentIndex = try typeContainer.decodeIfPresent(Int.self, forKey: .currentIndex) { - self.currentIndex = currentIndex - } - - if let alwaysSendAction = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysSendAction) { - self.alwaysSendAction = alwaysSendAction - } - - if let position = try typeContainer.decodeIfPresent(Float.self, forKey: .position) { - self.position = position - } - - if let isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) { - self.isAnimated = isAnimated - } - - if let hidesForSinglePage = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidesForSinglePage) { - self.hidesForSinglePage = hidesForSinglePage - } - - if let accessibilityHasSlidesInsteadOfPage = try typeContainer.decodeIfPresent(Bool.self, forKey: .accessibilityHasSlidesInsteadOfPage) { - self.accessibilityHasSlidesInsteadOfPage = accessibilityHasSlidesInsteadOfPage - } - - if let isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) { - self.isEnabled = isEnabled - } - - if let disabledIndicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledIndicatorColor) { - self.disabledIndicatorColor = disabledIndicatorColor - } - - if let indicatorColor = try typeContainer.decodeIfPresent(Color.self, forKey: .indicatorColor) { - self.indicatorColor = indicatorColor - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encodeIfPresent(moleculeName, forKey: .moleculeName) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - try container.encode(numberOfPages, forKey: .numberOfPages) - try container.encode(currentIndex, forKey: .currentIndex) - try container.encode(alwaysSendAction, forKey: .alwaysSendAction) - try container.encode(isAnimated, forKey: .isAnimated) - try container.encodeIfPresent(hidesForSinglePage, forKey: .hidesForSinglePage) - try container.encodeIfPresent(accessibilityHasSlidesInsteadOfPage, forKey: .accessibilityHasSlidesInsteadOfPage) - try container.encode(isEnabled, forKey: .isEnabled) - try container.encode(disabledIndicatorColor, forKey: .disabledIndicatorColor) - try container.encode(indicatorColor, forKey: .indicatorColor) - try container.encodeIfPresent(position, forKey: .position) - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericCarouselIndicatorModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericCarouselIndicatorModel.swift deleted file mode 100644 index 2b454fc8..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericCarouselIndicatorModel.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// NumericCarouselIndicatorModel.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 3/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - -open class NumericCarouselIndicatorModel: CarouselIndicatorModel { - //-------------------------------------------------- - // MARK: - Properties - //-------------------------------------------------- - - public class override var identifier: String { - return "numericCarouselIndicator" - } -} diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericIndicatorView.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericIndicatorView.swift deleted file mode 100644 index 8cd9e05c..00000000 --- a/MVMCoreUI/Atomic/Atoms/Buttons/CarouselIndicator/NumericIndicatorView.swift +++ /dev/null @@ -1,131 +0,0 @@ -// -// NumericIndicatorView.swift -// MVMCoreUI -// -// Created by Kevin Christiano on 2/3/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import UIKit - - -open class NumericIndicatorView: CarouselIndicator { - //-------------------------------------------------- - // MARK: - Outlets - //-------------------------------------------------- - - /// Text to display the current count of total pages for viewing. - open var pageCount: Label = { - let label = Label.commonLabelB2(true) - label.setContentCompressionResistancePriority(.required, for: .vertical) - label.textAlignment = .center - return label - }() - - let leftArrow: Arrow = { - let arrow = Arrow(model: ArrowModel(), degrees: 180) - arrow.pinHeightAndWidth() - return arrow - }() - - let rightArrow: Arrow = { - let arrow = Arrow(model: ArrowModel()) - arrow.pinHeightAndWidth() - return arrow - }() - - //-------------------------------------------------- - // MARK: - Computed Properties - //-------------------------------------------------- - - open override var isEnabled: Bool { - didSet { - pageCount.textColor = isEnabled ? indicatorColor : disabledIndicatorColor - leftArrow.tintColor = isEnabled ? indicatorColor : disabledIndicatorColor - rightArrow.tintColor = isEnabled ? indicatorColor : disabledIndicatorColor - } - } - - /// Sets the color for pageCount text, left arrow and right arrow. - public override var indicatorColor: UIColor { - get { return _indicatorColor } - set (newColor) { - super.indicatorColor = newColor - - if isEnabled { - pageCount.textColor = newColor - leftArrow.tintColor = newColor - rightArrow.tintColor = newColor - } - } - } - - //-------------------------------------------------- - // MARK: - Initializers - //-------------------------------------------------- - - public override init(frame: CGRect) { - super.init(frame: .zero) - } - - public convenience init() { - self.init(frame: .zero) - } - - public required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - //-------------------------------------------------- - // MARK: - Lifecycle - //-------------------------------------------------- - - open override func updateView(_ size: CGFloat) { - super.updateView(size) - pageCount.updateView(size) - } - - //-------------------------------------------------- - // MARK: - Setup - //-------------------------------------------------- - - open override func setupView() { - super.setupView() - - isUserInteractionEnabled = false - addSubview(pageCount) - addSubview(leftArrow) - addSubview(rightArrow) - - NSLayoutConstraint.activate([ - pageCount.centerXAnchor.constraint(equalTo: centerXAnchor), - pageCount.topAnchor.constraint(equalTo: topAnchor), - bottomAnchor.constraint(equalTo: pageCount.bottomAnchor), - leftArrow.centerYAnchor.constraint(equalTo: centerYAnchor), - rightArrow.centerYAnchor.constraint(equalTo: centerYAnchor), - leftArrow.leadingAnchor.constraint(equalTo: leadingAnchor), - pageCount.leadingAnchor.constraint(equalTo: leftArrow.trailingAnchor, constant: PaddingOne), - rightArrow.leadingAnchor.constraint(equalTo: pageCount.trailingAnchor, constant: PaddingOne), - trailingAnchor.constraint(equalTo: rightArrow.trailingAnchor) - ]) - } - - public override func assessTouchOf(_ touchPoint_X: CGFloat) { - - if touchPoint_X > bounds.width / 2 { - incrementCurrentIndex() - } else { - decrementCurrentIndex() - } - } - - //-------------------------------------------------- - // MARK: - IndicatorViewProtocol - //-------------------------------------------------- - - open override func updateUI(previousIndex oldIndex: Int, newIndex: Int, totalCount: Int, isAnimated: Bool) { - - pageCount.text = "\(newIndex + 1)/\(totalCount)" - layoutIfNeeded() - } -}