From 3470e77b76da81330e7f6b307ce538eb8e1e2c7b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 28 Feb 2020 13:10:15 -0500 Subject: [PATCH] latest state --- .../CarouselIndicator/CarouselIndicator.swift | 4 ++- .../IndicatorViews/NumericIndicatorView.swift | 33 ++++++++----------- MVMCoreUI/BaseClasses/ImageView.swift | 2 +- MVMCoreUI/BaseClasses/StackView.swift | 8 ++--- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/CarouselIndicator/CarouselIndicator.swift b/MVMCoreUI/Atoms/Views/CarouselIndicator/CarouselIndicator.swift index 03a590c4..e12b9c0d 100644 --- a/MVMCoreUI/Atoms/Views/CarouselIndicator/CarouselIndicator.swift +++ b/MVMCoreUI/Atoms/Views/CarouselIndicator/CarouselIndicator.swift @@ -329,7 +329,9 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol { // MARK: - MoleculeViewProtocol //-------------------------------------------------- - open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + + + open override func set(with model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { // super.setWithModel(model, delegateObject, additionalData) guard let model = model as? CarouselIndicatorModel else { return } diff --git a/MVMCoreUI/Atoms/Views/CarouselIndicator/IndicatorViews/NumericIndicatorView.swift b/MVMCoreUI/Atoms/Views/CarouselIndicator/IndicatorViews/NumericIndicatorView.swift index 6515440c..cb91e1d3 100644 --- a/MVMCoreUI/Atoms/Views/CarouselIndicator/IndicatorViews/NumericIndicatorView.swift +++ b/MVMCoreUI/Atoms/Views/CarouselIndicator/IndicatorViews/NumericIndicatorView.swift @@ -22,22 +22,18 @@ open class NumericIndicatorView: View, IndicatorViewProtocol { return label }() - let leftArrow: ImageView = { - let arrow = UIImage(named: "peakingRightArrow")?.withRenderingMode(.alwaysTemplate).withHorizontallyFlippedOrientation() - let imageView = ImageView(image: arrow) - imageView.tintColor = .mvmBlack - imageView.heightAnchor.constraint(equalToConstant: PaddingTwo).isActive = true - imageView.widthAnchor.constraint(equalToConstant: PaddingTwo).isActive = true - return imageView + let leftArrow: Arrow = { + let arrow = Arrow() + (arrow.model as? ArrowModel)?.degrees = 180 + arrow.pinHeightAndWidth() + arrow.setNeedsDisplay() + return arrow }() - let rightArrow: ImageView = { - let arrow = UIImage(named: "peakingRightArrow")?.withRenderingMode(.alwaysTemplate) - let imageView = ImageView(image: arrow) - imageView.tintColor = .mvmBlack - imageView.heightAnchor.constraint(equalToConstant: PaddingTwo).isActive = true - imageView.widthAnchor.constraint(equalToConstant: PaddingTwo).isActive = true - return imageView + let rightArrow: Arrow = { + let arrow = Arrow() + arrow.pinHeightAndWidth() + return arrow }() //-------------------------------------------------- @@ -93,17 +89,16 @@ open class NumericIndicatorView: View, IndicatorViewProtocol { isUserInteractionEnabled = false addSubview(pageCountLabel) + addSubview(leftArrow) + addSubview(rightArrow) + pageCountLabel.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true pageCountLabel.topAnchor.constraint(equalTo: topAnchor).isActive = true bottomAnchor.constraint(equalTo: pageCountLabel.bottomAnchor).isActive = true - - addSubview(leftArrow) leftArrow.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true - - addSubview(rightArrow) rightArrow.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true - NSLayoutConstraint.activate(NSLayoutConstraint.constraints(withVisualFormat: "H:|[leftArrow]-(padding)-[pageCountLabel]-(padding)-[rightArrow]|", + NSLayoutConstraint.activate(NSLayoutConstraint.constraints(withVisualFormat: "H:|-[leftArrow]-(padding)-[pageCountLabel]-(padding)-[rightArrow]-|", options: .directionLeadingToTrailing, metrics: ["padding": PaddingOne], views: ["leftArrow": leftArrow, diff --git a/MVMCoreUI/BaseClasses/ImageView.swift b/MVMCoreUI/BaseClasses/ImageView.swift index b240bbeb..461397a8 100644 --- a/MVMCoreUI/BaseClasses/ImageView.swift +++ b/MVMCoreUI/BaseClasses/ImageView.swift @@ -60,7 +60,7 @@ open class ImageView: UIImageView, ModelMoleculeViewProtocol { } - open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + open func set(with model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model if let backgroundColor = model?.backgroundColor { self.backgroundColor = backgroundColor.uiColor diff --git a/MVMCoreUI/BaseClasses/StackView.swift b/MVMCoreUI/BaseClasses/StackView.swift index 4742972e..4ca167c6 100644 --- a/MVMCoreUI/BaseClasses/StackView.swift +++ b/MVMCoreUI/BaseClasses/StackView.swift @@ -48,13 +48,9 @@ open class StackView: UIStackView, ModelMoleculeViewProtocol { // MARK: - ModelMoleculeViewProtocol //-------------------------------------------------- - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - - } - - open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model - if let backgroundColor = model?.backgroundColor { + if let backgroundColor = model.backgroundColor { self.backgroundColor = backgroundColor.uiColor } }