From f3cc8c479ad3e300b07fb32f7c8fbfabe05195bb Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 20 May 2020 16:34:40 -0400 Subject: [PATCH 01/42] new addition --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 47 ++++++++++---------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index ba954d23..54f0efed 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -72,6 +72,8 @@ 0A25209824645B76000FA9F6 /* TextViewEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A25209724645B76000FA9F6 /* TextViewEntryFieldModel.swift */; }; 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; }; 0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; }; + 0A51F3E22475CB73002E08B6 /* LoadingSpinnerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */; }; + 0A51F3E32475CB73002E08B6 /* LoadingSpinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */; }; 0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; }; 0A6682A22434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */; }; 0A6682A42434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */; }; @@ -487,6 +489,8 @@ 0A25209724645B76000FA9F6 /* TextViewEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewEntryFieldModel.swift; sourceTree = ""; }; 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CATransaction+Extension.swift"; sourceTree = ""; }; 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryField.swift; sourceTree = ""; }; + 0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingSpinnerModel.swift; sourceTree = ""; }; + 0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingSpinner.swift; sourceTree = ""; }; 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.swift; sourceTree = ""; }; 0A6682A12434DB4F00AD3CA1 /* ListLeftVariableRadioButtonBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonBodyText.swift; sourceTree = ""; }; 0A6682A32434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonBodyTextModel.swift; sourceTree = ""; }; @@ -1649,6 +1653,8 @@ 94382085243238D100B43AF3 /* WebViewModel.swift */, 943820832432382400B43AF3 /* WebView.swift */, D20492A524329CE200A5EED6 /* LoadImageView.swift */, + 0A51F3E02475CB73002E08B6 /* LoadingSpinnerModel.swift */, + 0A51F3E12475CB73002E08B6 /* LoadingSpinner.swift */, ); path = Views; sourceTree = ""; @@ -2206,6 +2212,7 @@ 012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */, D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, + 0A51F3E22475CB73002E08B6 /* LoadingSpinnerModel.swift in Sources */, 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */, D253BB9C245874F8002DE544 /* BGImageMolecule.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, @@ -2232,6 +2239,7 @@ 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */, D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */, + 0A51F3E32475CB73002E08B6 /* LoadingSpinner.swift in Sources */, 012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */, 94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */, D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index e46cfed0..23714df1 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -36,12 +36,12 @@ import Foundation /// Call to register all of the CoreUI molecules. public static func registerObjects() { - // Stacks + // MARK:- Stacks MoleculeObjectMapping.shared()?.register(viewClass: MoleculeStackView.self, viewModelClass: StackModel.self) MoleculeObjectMapping.shared()?.register(viewClass: UnOrderedList.self, viewModelClass: UnOrderedListModel.self) MoleculeObjectMapping.shared()?.register(viewClass: NumberedList.self, viewModelClass: NumberedListModel.self) - // Label + // MARK:- Label MoleculeObjectMapping.shared()?.register(viewClass: Label.self, viewModelClass: LabelModel.self) // need to move labelattributemodel to different method try? ModelRegistry.register(LabelAttributeFontModel.self) @@ -51,30 +51,30 @@ import Foundation try? ModelRegistry.register(LabelAttributeStrikeThroughModel.self) try? ModelRegistry.register(LabelAttributeActionModel.self) - // TextView + // MARK:- TextView MoleculeObjectMapping.shared()?.register(viewClass: TextViewEntryField.self, viewModelClass: TextViewEntryFieldModel.self) - // Buttons + // MARK:- Buttons MoleculeObjectMapping.shared()?.register(viewClass: PillButton.self, viewModelClass: ButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: TwoButtonView.self, viewModelClass: TwoButtonViewModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ExternalLink.self, viewModelClass: ExternalLinkModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Link.self, viewModelClass: LinkModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CaretLink.self, viewModelClass: CaretLinkModel.self) - // Entry Field + // MARK:- Entry Field MoleculeObjectMapping.shared()?.register(viewClass: TextEntryField.self, viewModelClass: TextEntryFieldModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MdnEntryField.self, viewModelClass: MdnEntryFieldModel.self) MoleculeObjectMapping.shared()?.register(viewClass: DigitEntryField.self, viewModelClass: DigitEntryFieldModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ItemDropdownEntryField.self, viewModelClass: ItemDropdownEntryFieldModel.self) MoleculeObjectMapping.shared()?.register(viewClass: DateDropdownEntryField.self, viewModelClass: DateDropdownEntryFieldModel.self) - // Selectors + // MARK:- Selectors MoleculeObjectMapping.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioBoxes.self, viewModelClass: RadioBoxesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self) - // Other Atoms + // MARK:- Other Atoms MoleculeObjectMapping.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MultiProgress.self, viewModelClass: MultiProgressBarModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CaretView.self, viewModelClass: CaretViewModel.self) @@ -87,14 +87,15 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) MoleculeObjectMapping.shared()?.register(viewClass: WebView.self, viewModelClass: WebViewModel.self) - - // Horizontal Combination Molecules + MoleculeObjectMapping.shared()?.register(viewClass: LoadingSpinner.self, viewModelClass: LoadingSpinnerModel.self) + + // MARK:- Horizontal Combination Molecules MoleculeObjectMapping.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Tabs.self, viewModelClass: TabsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: TwoLinkView.self, viewModelClass: TwoLinkViewModel.self) - // Vertical Combination Molecules + // MARK:- Vertical Combination Molecules MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) @@ -102,7 +103,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: BGImageHeadlineBodyButton.self, viewModelClass: BGImageHeadlineBodyButtonModel.self) - // Left Right Molecules + // MARK:- Left Right Molecules MoleculeObjectMapping.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self) MoleculeObjectMapping.shared()?.register(viewClass: LabelToggle.self, viewModelClass: LabelToggleModel.self) @@ -110,21 +111,21 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - // List items + // MARK:- List items MoleculeObjectMapping.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) - // Other Items + // MARK:- Other Items MoleculeObjectMapping.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self) - // Other Container Molecules + // MARK:- Other Container Molecules MoleculeObjectMapping.shared()?.register(viewClass: MoleculeContainer.self, viewModelClass: MoleculeContainerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) MoleculeObjectMapping.shared()?.register(viewClass: FooterView.self, viewModelClass: FooterModel.self) @@ -132,15 +133,15 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ModuleMolecule.self, viewModelClass: ModuleMoleculeModel.self) MoleculeObjectMapping.shared()?.register(viewClass: BGImageMolecule.self, viewModelClass: BGImageMoleculeModel.self) - // Other Molecules + // MARK:- Other Molecules MoleculeObjectMapping.shared()?.register(viewClass: DoughnutChartView.self, viewModelClass: DoughnutChartModel.self) - // Other Organisms + // MARK:- Other Organisms MoleculeObjectMapping.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) MoleculeObjectMapping.shared()?.register(viewClass: BarsIndicatorView.self, viewModelClass: BarsCarouselIndicatorModel.self) MoleculeObjectMapping.shared()?.register(viewClass: NumericIndicatorView.self, viewModelClass: NumericCarouselIndicatorModel.self) - // Designed List Items + // MARK:- Designed List Items MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) @@ -165,7 +166,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarThin.self, viewModelClass: ListProgressBarThinModel.self) - // Designed Section Dividers + // MARK:- Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) @@ -177,19 +178,19 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnBillChangesDivider.self, viewModelClass: ListThreeColumnBillChangesDividerModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsageDivider.self, viewModelClass: ListThreeColumnDataUsageDividerModel.self) - // Designed Headers + // MARK:- Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2TinyButton.self, viewModelClass: HeadersH2TinyButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) - // Device Items + // MARK:- Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonSmall.self, viewModelClass: ListDeviceComplexButtonSmallModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkSmall.self, viewModelClass: ListDeviceComplexLinkSmallModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self) - // Helper models + // MARK:- Helper models try? ModelRegistry.register(RuleRequiredModel.self) try? ModelRegistry.register(RuleAnyRequiredModel.self) try? ModelRegistry.register(RuleAnyValueChangedModel.self) @@ -198,12 +199,12 @@ import Foundation try? ModelRegistry.register(RuleEqualsIgnoreCaseModel.self) try? ModelRegistry.register(RuleRegexModel.self) - // Actions + // MARK:- Actions try? ModelRegistry.register(ActionTopAlertModel.self) try? ModelRegistry.register(ActionCollapseNotificationModel.self) try? ModelRegistry.register(ActionOpenPanelModel.self) - // Behaviors + // MARK:- Behaviors try? ModelRegistry.register(ScreenBrightnessModifierBehavior.self) } From 15a51bd86f444274406a6d3b428abf5422152a60 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 20 May 2020 16:36:41 -0400 Subject: [PATCH 02/42] adding to src --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 181 ++++++++++++++++++ .../Atoms/Views/LoadingSpinnerModel.swift | 58 ++++++ 2 files changed, 239 insertions(+) create mode 100644 MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift create mode 100644 MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift new file mode 100644 index 00000000..fbe49535 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -0,0 +1,181 @@ +// +// LoadingSpinner.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 5/20/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + + +open class LoadingSpinner: View { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public var strokeColor: UIColor = .mvmBlack + + public var lineWidth: CGFloat = 3.0 + + public var speed: Float = 1.5 + + //-------------------------------------------------- + // MARK: - Lifecycle + //-------------------------------------------------- + + override open func setupView() { + super.setupView() + + // TODO: remove + pinWidthAndHeight(radius: 20) + } + + override open var layer: CAShapeLayer { + get { return super.layer as! CAShapeLayer } + } + + override open class var layerClass: AnyClass { + return CAShapeLayer.self + } + + override open func layoutSubviews() { + super.layoutSubviews() + layer.fillColor = nil + layer.strokeColor = strokeColor.cgColor + layer.lineWidth = lineWidth + layer.lineCap = .butt + layer.speed = speed + layer.path = UIBezierPath(ovalIn: bounds.insetBy(dx: lineWidth / 2, dy: lineWidth / 2)).cgPath + } + + //-------------------------------------------------- + // MARK: - Animation + //-------------------------------------------------- + + override open func didMoveToWindow() { + animate() + } + + struct Pose { + let secondsSincePriorPose: CFTimeInterval + let start: CGFloat + let length: CGFloat + init(_ secondsSincePriorPose: CFTimeInterval, _ start: CGFloat, _ length: CGFloat) { + self.secondsSincePriorPose = secondsSincePriorPose + self.start = start + self.length = length + } + } + + // TODO: This needs more attention + class var poses: [Pose] { + get { + return [ + Pose(0.0, 0.000, 0.8), + Pose(0.6, 0.500, 0.5), + Pose(0.6, 1.000, 0.3), + Pose(0.6, 1.500, 0.1), + Pose(0.2, 1.875, 0.1), + Pose(0.2, 2.250, 0.3), + Pose(0.2, 2.625, 0.5), + Pose(0.2, 3.000, 0.7) + ] + } + } + + private func animate() { + var time: CFTimeInterval = 0 + var times = [CFTimeInterval]() + var start: CGFloat = 0 + var rotations = [CGFloat]() + var strokeEnds = [CGFloat]() + + let poses = Self.poses + let totalSeconds = poses.reduce(0) { $0 + $1.secondsSincePriorPose } + + for pose in poses { + time += pose.secondsSincePriorPose + times.append(time / totalSeconds) + start = pose.start + rotations.append(start * 2 * CGFloat.pi) + strokeEnds.append(pose.length) + } + + times.append(times.last!) + rotations.append(rotations[0]) + strokeEnds.append(strokeEnds[0]) + + animateKeyPath(keyPath: "strokeEnd", duration: totalSeconds, times: times, values: strokeEnds) + animateKeyPath(keyPath: "transform.rotation", duration: totalSeconds, times: times, values: rotations) + } + + private func animateKeyPath(keyPath: String, duration: CFTimeInterval, times: [CFTimeInterval], values: [CGFloat]) { + + let animation = CAKeyframeAnimation(keyPath: keyPath) + animation.keyTimes = times as [NSNumber]? + animation.values = values + animation.calculationMode = .linear + animation.duration = duration + animation.rotationMode = .rotateAuto + animation.isRemovedOnCompletion = false + animation.repeatCount = .infinity + layer.add(animation, forKey: animation.keyPath) + } + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + + func resumeSpinnerAfterDelay() { + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in + self?.resumeAnimations() + } + } + + func pauseAnimations() { + let pausedTime = layer.convertTime(CACurrentMediaTime(), from: nil) + layer.speed = 0 + isHidden = true + layer.timeOffset = pausedTime + } + + func resumeAnimations() { + let pausedTime = layer.timeOffset + isHidden = false + layer.speed = speed + layer.timeOffset = 0 + layer.beginTime = 0 + let timeSincePause = layer.convertTime(CACurrentMediaTime(), from: nil) - pausedTime + layer.beginTime = timeSincePause + } + + func stopAllAnimations() { + layer.removeAllAnimations() + } + + func pinWidthAndHeight(radius: CGFloat) { + let diameter: CGFloat = radius * 2 + lineWidth + NSLayoutConstraint.activate([ + heightAnchor.constraint(equalToConstant: diameter), + widthAnchor.constraint(equalToConstant: diameter) + ]) + } + + //-------------------------------------------------- + // MARK: - MoleculeViewProtocol + //-------------------------------------------------- + + public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? LoadingSpinnerModel else { return } + + strokeColor = model.strokeColor.uiColor + lineWidth = model.lineWidth + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 40.0 + } +} diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift new file mode 100644 index 00000000..604c0689 --- /dev/null +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift @@ -0,0 +1,58 @@ +// +// LoadingSpinnerModel.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 5/20/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + + +open class LoadingSpinnerModel: MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public var backgroundColor: Color? + public static var identifier: String = "loadingSpinner" + public var strokeColor = Color(uiColor: .mvmBlack) + public var lineWidth: CGFloat = 3 + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case strokeColor + case lineWidth + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + + if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) { + self.strokeColor = strokeColor + } + + if let lineWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .lineWidth) { + self.lineWidth = lineWidth + } + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(strokeColor, forKey: .strokeColor) + try container.encode(lineWidth, forKey: .lineWidth) + } +} From eda9379e3719cafe8434618643380218c8eefd71 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 20 May 2020 17:08:43 -0400 Subject: [PATCH 03/42] adjusment --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index fbe49535..929bb5ed 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -72,12 +72,12 @@ open class LoadingSpinner: View { class var poses: [Pose] { get { return [ - Pose(0.0, 0.000, 0.8), - Pose(0.6, 0.500, 0.5), + Pose(0.0, 0.000, 0.7), + Pose(0.7, 0.500, 0.5), Pose(0.6, 1.000, 0.3), - Pose(0.6, 1.500, 0.1), - Pose(0.2, 1.875, 0.1), - Pose(0.2, 2.250, 0.3), + Pose(0.4, 1.500, 0.2), + Pose(0.3, 1.875, 0.2), + Pose(0.3, 2.250, 0.3), Pose(0.2, 2.625, 0.5), Pose(0.2, 3.000, 0.7) ] @@ -118,6 +118,7 @@ open class LoadingSpinner: View { animation.calculationMode = .linear animation.duration = duration animation.rotationMode = .rotateAuto + animation.fillMode = .forwards animation.isRemovedOnCompletion = false animation.repeatCount = .infinity layer.add(animation, forKey: animation.keyPath) From 898877a05105c440e72c455fa0e8e78a51ca5524 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 21 May 2020 10:44:21 -0400 Subject: [PATCH 04/42] curent working order --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 929bb5ed..74eeb2dc 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -58,28 +58,23 @@ open class LoadingSpinner: View { } struct Pose { - let secondsSincePriorPose: CFTimeInterval + let delay: CFTimeInterval let start: CGFloat let length: CGFloat - init(_ secondsSincePriorPose: CFTimeInterval, _ start: CGFloat, _ length: CGFloat) { - self.secondsSincePriorPose = secondsSincePriorPose - self.start = start - self.length = length - } } // TODO: This needs more attention class var poses: [Pose] { get { return [ - Pose(0.0, 0.000, 0.7), - Pose(0.7, 0.500, 0.5), - Pose(0.6, 1.000, 0.3), - Pose(0.4, 1.500, 0.2), - Pose(0.3, 1.875, 0.2), - Pose(0.3, 2.250, 0.3), - Pose(0.2, 2.625, 0.5), - Pose(0.2, 3.000, 0.7) + Pose(delay: 0.0, start: 0.000, length: 0.7), + Pose(delay: 0.7, start: 0.500, length: 0.5), + Pose(delay: 0.6, start: 1.000, length: 0.3), + Pose(delay: 0.5, start: 1.500, length: 0.2), + Pose(delay: 0.4, start: 1.875, length: 0.2), + Pose(delay: 0.3, start: 2.250, length: 0.3), + Pose(delay: 0.2, start: 2.600, length: 0.5), + Pose(delay: 0.2, start: 3.000, length: 0.7) ] } } @@ -92,19 +87,19 @@ open class LoadingSpinner: View { var strokeEnds = [CGFloat]() let poses = Self.poses - let totalSeconds = poses.reduce(0) { $0 + $1.secondsSincePriorPose } + let totalSeconds = poses.reduce(0) { $0 + $1.delay } for pose in poses { - time += pose.secondsSincePriorPose + time += pose.delay times.append(time / totalSeconds) start = pose.start rotations.append(start * 2 * CGFloat.pi) strokeEnds.append(pose.length) } - times.append(times.last!) - rotations.append(rotations[0]) - strokeEnds.append(strokeEnds[0]) +// times.append(times.last ?? 1) +// rotations.append(rotations[0]) +// strokeEnds.append(strokeEnds[0]) animateKeyPath(keyPath: "strokeEnd", duration: totalSeconds, times: times, values: strokeEnds) animateKeyPath(keyPath: "transform.rotation", duration: totalSeconds, times: times, values: rotations) @@ -116,6 +111,7 @@ open class LoadingSpinner: View { animation.keyTimes = times as [NSNumber]? animation.values = values animation.calculationMode = .linear + animation.timingFunction = CAMediaTimingFunction(name: .linear) animation.duration = duration animation.rotationMode = .rotateAuto animation.fillMode = .forwards @@ -136,6 +132,7 @@ open class LoadingSpinner: View { } func pauseAnimations() { + let pausedTime = layer.convertTime(CACurrentMediaTime(), from: nil) layer.speed = 0 isHidden = true @@ -143,6 +140,7 @@ open class LoadingSpinner: View { } func resumeAnimations() { + let pausedTime = layer.timeOffset isHidden = false layer.speed = speed @@ -153,11 +151,14 @@ open class LoadingSpinner: View { } func stopAllAnimations() { + layer.removeAllAnimations() } func pinWidthAndHeight(radius: CGFloat) { + let diameter: CGFloat = radius * 2 + lineWidth + NSLayoutConstraint.activate([ heightAnchor.constraint(equalToConstant: diameter), widthAnchor.constraint(equalToConstant: diameter) From 9803f04a788b6aca06ac42245ade1556f555e8ca Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 21 May 2020 16:21:19 -0400 Subject: [PATCH 05/42] current --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 74eeb2dc..3a00df8d 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -44,9 +44,12 @@ open class LoadingSpinner: View { layer.fillColor = nil layer.strokeColor = strokeColor.cgColor layer.lineWidth = lineWidth - layer.lineCap = .butt + layer.lineCap = .round layer.speed = speed - layer.path = UIBezierPath(ovalIn: bounds.insetBy(dx: lineWidth / 2, dy: lineWidth / 2)).cgPath + let halfWidth = lineWidth / 2 + let radius = (bounds.width - lineWidth) / 2 + layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, y: radius + halfWidth), radius: radius, startAngle: -CGFloat.pi / 2, endAngle: 2.5 * CGFloat.pi, clockwise: true).cgPath + } //-------------------------------------------------- @@ -79,6 +82,25 @@ open class LoadingSpinner: View { } } + // I like this +// Pose(delay: 0.0, start: 0.000, length: 0.75), +// Pose(delay: 0.7, start: 0.500, length: 0.55), +// Pose(delay: 0.5, start: 1.000, length: 0.35), +// Pose(delay: 0.4, start: 1.500, length: 0.4), +// Pose(delay: 0.3, start: 1.875, length: 0.25), +// Pose(delay: 0.3, start: 2.250, length: 0.4), +// Pose(delay: 0.4, start: 2.600, length: 0.55), +// Pose(delay: 0.4, start: 3.000, length: 0.7) + +// Pose(delay: 0.0, start: 0.000, length: 0.7), +// Pose(delay: 0.7, start: 0.500, length: 0.5), +// Pose(delay: 0.6, start: 1.000, length: 0.3), +// Pose(delay: 0.5, start: 1.500, length: 0.2), +// Pose(delay: 0.4, start: 1.875, length: 0.2), +// Pose(delay: 0.3, start: 2.250, length: 0.3), +// Pose(delay: 0.2, start: 2.600, length: 0.5), +// Pose(delay: 0.2, start: 3.000, length: 0.7) + private func animate() { var time: CFTimeInterval = 0 var times = [CFTimeInterval]() From b0172ff1f61c39ee8d4e42f79657df9899ec16d6 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 21 May 2020 16:28:21 -0400 Subject: [PATCH 06/42] bu 2 --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 3a00df8d..6bee5ea6 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -48,7 +48,7 @@ open class LoadingSpinner: View { layer.speed = speed let halfWidth = lineWidth / 2 let radius = (bounds.width - lineWidth) / 2 - layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, y: radius + halfWidth), radius: radius, startAngle: -CGFloat.pi / 2, endAngle: 2.5 * CGFloat.pi, clockwise: true).cgPath + layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, y: radius + halfWidth), radius: radius, startAngle: -CGFloat.pi / 2, endAngle: 2 * CGFloat.pi, clockwise: true).cgPath } From 8a5a2486284cc4bc87dd0870a35d51120adeb8a9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 22 May 2020 09:26:13 -0400 Subject: [PATCH 07/42] latestest state. almost there --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 6bee5ea6..9842ce5a 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -61,8 +61,11 @@ open class LoadingSpinner: View { } struct Pose { + /// Delayed time (in seconds) to execute after the previous Pose. let delay: CFTimeInterval + /// The time into the animation to begin. let start: CGFloat + /// The length of the drawn line. let length: CGFloat } @@ -70,6 +73,7 @@ open class LoadingSpinner: View { class var poses: [Pose] { get { return [ +// Pose(delay: 0.0, start: 1.250, length: 0.7), Pose(delay: 0.0, start: 0.000, length: 0.7), Pose(delay: 0.7, start: 0.500, length: 0.5), Pose(delay: 0.6, start: 1.000, length: 0.3), @@ -78,29 +82,19 @@ open class LoadingSpinner: View { Pose(delay: 0.3, start: 2.250, length: 0.3), Pose(delay: 0.2, start: 2.600, length: 0.5), Pose(delay: 0.2, start: 3.000, length: 0.7) + + // Pose(delay: 0.0, start: 0.000, length: 0.75), + // Pose(delay: 0.7, start: 0.500, length: 0.55), + // Pose(delay: 0.5, start: 1.000, length: 0.35), + // Pose(delay: 0.4, start: 1.500, length: 0.4), + // Pose(delay: 0.3, start: 1.875, length: 0.25), + // Pose(delay: 0.3, start: 2.250, length: 0.4), + // Pose(delay: 0.4, start: 2.600, length: 0.55), + // Pose(delay: 0.4, start: 3.000, length: 0.7) ] } } - // I like this -// Pose(delay: 0.0, start: 0.000, length: 0.75), -// Pose(delay: 0.7, start: 0.500, length: 0.55), -// Pose(delay: 0.5, start: 1.000, length: 0.35), -// Pose(delay: 0.4, start: 1.500, length: 0.4), -// Pose(delay: 0.3, start: 1.875, length: 0.25), -// Pose(delay: 0.3, start: 2.250, length: 0.4), -// Pose(delay: 0.4, start: 2.600, length: 0.55), -// Pose(delay: 0.4, start: 3.000, length: 0.7) - -// Pose(delay: 0.0, start: 0.000, length: 0.7), -// Pose(delay: 0.7, start: 0.500, length: 0.5), -// Pose(delay: 0.6, start: 1.000, length: 0.3), -// Pose(delay: 0.5, start: 1.500, length: 0.2), -// Pose(delay: 0.4, start: 1.875, length: 0.2), -// Pose(delay: 0.3, start: 2.250, length: 0.3), -// Pose(delay: 0.2, start: 2.600, length: 0.5), -// Pose(delay: 0.2, start: 3.000, length: 0.7) - private func animate() { var time: CFTimeInterval = 0 var times = [CFTimeInterval]() @@ -119,10 +113,6 @@ open class LoadingSpinner: View { strokeEnds.append(pose.length) } -// times.append(times.last ?? 1) -// rotations.append(rotations[0]) -// strokeEnds.append(strokeEnds[0]) - animateKeyPath(keyPath: "strokeEnd", duration: totalSeconds, times: times, values: strokeEnds) animateKeyPath(keyPath: "transform.rotation", duration: totalSeconds, times: times, values: rotations) } From 05346d81fac604660c5a64d02de309ca1dc7f3f5 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 22 May 2020 16:13:01 -0400 Subject: [PATCH 08/42] loosk pretty good on device --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 9842ce5a..4a82793b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -73,7 +73,6 @@ open class LoadingSpinner: View { class var poses: [Pose] { get { return [ -// Pose(delay: 0.0, start: 1.250, length: 0.7), Pose(delay: 0.0, start: 0.000, length: 0.7), Pose(delay: 0.7, start: 0.500, length: 0.5), Pose(delay: 0.6, start: 1.000, length: 0.3), @@ -82,15 +81,6 @@ open class LoadingSpinner: View { Pose(delay: 0.3, start: 2.250, length: 0.3), Pose(delay: 0.2, start: 2.600, length: 0.5), Pose(delay: 0.2, start: 3.000, length: 0.7) - - // Pose(delay: 0.0, start: 0.000, length: 0.75), - // Pose(delay: 0.7, start: 0.500, length: 0.55), - // Pose(delay: 0.5, start: 1.000, length: 0.35), - // Pose(delay: 0.4, start: 1.500, length: 0.4), - // Pose(delay: 0.3, start: 1.875, length: 0.25), - // Pose(delay: 0.3, start: 2.250, length: 0.4), - // Pose(delay: 0.4, start: 2.600, length: 0.55), - // Pose(delay: 0.4, start: 3.000, length: 0.7) ] } } From b05b6c20c08478a570952d821d5d38cb4d05cd75 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 26 May 2020 09:38:08 -0400 Subject: [PATCH 09/42] looking bette --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 4a82793b..675e40d0 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -77,7 +77,7 @@ open class LoadingSpinner: View { Pose(delay: 0.7, start: 0.500, length: 0.5), Pose(delay: 0.6, start: 1.000, length: 0.3), Pose(delay: 0.5, start: 1.500, length: 0.2), - Pose(delay: 0.4, start: 1.875, length: 0.2), + Pose(delay: 0.5, start: 1.875, length: 0.2), Pose(delay: 0.3, start: 2.250, length: 0.3), Pose(delay: 0.2, start: 2.600, length: 0.5), Pose(delay: 0.2, start: 3.000, length: 0.7) @@ -93,7 +93,7 @@ open class LoadingSpinner: View { var strokeEnds = [CGFloat]() let poses = Self.poses - let totalSeconds = poses.reduce(0) { $0 + $1.delay } + var totalSeconds: CFTimeInterval = poses.reduce(0) { $0 + $1.delay } for pose in poses { time += pose.delay @@ -103,6 +103,8 @@ open class LoadingSpinner: View { strokeEnds.append(pose.length) } + totalSeconds += 0.3 + animateKeyPath(keyPath: "strokeEnd", duration: totalSeconds, times: times, values: strokeEnds) animateKeyPath(keyPath: "transform.rotation", duration: totalSeconds, times: times, values: rotations) } From c0f3e8a4501785d878bc53eaf7c78b48bf62aaa9 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 26 May 2020 10:40:34 -0400 Subject: [PATCH 10/42] renaming --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 675e40d0..68acdfb7 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -63,8 +63,8 @@ open class LoadingSpinner: View { struct Pose { /// Delayed time (in seconds) to execute after the previous Pose. let delay: CFTimeInterval - /// The time into the animation to begin. - let start: CGFloat + /// The time into the animation to begin drawing. + let startTime: CGFloat /// The length of the drawn line. let length: CGFloat } @@ -73,14 +73,14 @@ open class LoadingSpinner: View { class var poses: [Pose] { get { return [ - Pose(delay: 0.0, start: 0.000, length: 0.7), - Pose(delay: 0.7, start: 0.500, length: 0.5), - Pose(delay: 0.6, start: 1.000, length: 0.3), - Pose(delay: 0.5, start: 1.500, length: 0.2), - Pose(delay: 0.5, start: 1.875, length: 0.2), - Pose(delay: 0.3, start: 2.250, length: 0.3), - Pose(delay: 0.2, start: 2.600, length: 0.5), - Pose(delay: 0.2, start: 3.000, length: 0.7) + Pose(delay: 0.0, startTime: 0.000, length: 0.7), + Pose(delay: 0.7, startTime: 0.500, length: 0.5), + Pose(delay: 0.6, startTime: 1.000, length: 0.3), + Pose(delay: 0.5, startTime: 1.500, length: 0.2), + Pose(delay: 0.5, startTime: 1.875, length: 0.2), + Pose(delay: 0.3, startTime: 2.250, length: 0.3), + Pose(delay: 0.2, startTime: 2.600, length: 0.5), + Pose(delay: 0.2, startTime: 3.000, length: 0.7) ] } } @@ -98,7 +98,7 @@ open class LoadingSpinner: View { for pose in poses { time += pose.delay times.append(time / totalSeconds) - start = pose.start + start = pose.startTime rotations.append(start * 2 * CGFloat.pi) strokeEnds.append(pose.length) } From c6cfe39c3091905618eb39abd1391a67127dc106 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 26 May 2020 14:00:17 -0400 Subject: [PATCH 11/42] testing removed --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 68acdfb7..76d8cdd9 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -26,9 +26,6 @@ open class LoadingSpinner: View { override open func setupView() { super.setupView() - - // TODO: remove - pinWidthAndHeight(radius: 20) } override open var layer: CAShapeLayer { From bc9b54c1d19fd407bd134728e71add0c2f1aacd4 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 26 May 2020 14:21:49 -0400 Subject: [PATCH 12/42] design --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 76d8cdd9..a1238552 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -41,7 +41,7 @@ open class LoadingSpinner: View { layer.fillColor = nil layer.strokeColor = strokeColor.cgColor layer.lineWidth = lineWidth - layer.lineCap = .round + layer.lineCap = .butt layer.speed = speed let halfWidth = lineWidth / 2 let radius = (bounds.width - lineWidth) / 2 From 53660f17b975fd12b55e81dbf932fde486b1715d Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 26 May 2020 14:28:09 -0400 Subject: [PATCH 13/42] unsused func --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index a1238552..17be8ba2 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -24,10 +24,6 @@ open class LoadingSpinner: View { // MARK: - Lifecycle //-------------------------------------------------- - override open func setupView() { - super.setupView() - } - override open var layer: CAShapeLayer { get { return super.layer as! CAShapeLayer } } From 2397dbe25033b38e0ab4eb5ab5bd6fc3145d7e3e Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 11 Jun 2020 11:34:01 -0400 Subject: [PATCH 14/42] collor asset folder --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++ MVMCoreUI/Categories/UIColor+Extension.swift | 72 +++++++++---------- .../Categories/colors.xcassets/Contents.json | 6 ++ .../blue.colorset/Contents.json | 20 ++++++ .../blue33.colorset/Contents.json | 20 ++++++ .../blue66.colorset/Contents.json | 20 ++++++ .../blueInverted.colorset/Contents.json | 20 ++++++ .../blueShade1.colorset/Contents.json | 20 ++++++ .../blueShade2.colorset/Contents.json | 20 ++++++ .../coolGray1.colorset/Contents.json | 20 ++++++ .../coolGray10.colorset/Contents.json | 20 ++++++ .../coolGray3.colorset/Contents.json | 20 ++++++ .../coolGray6.colorset/Contents.json | 20 ++++++ .../green.colorset/Contents.json | 20 ++++++ .../green33.colorset/Contents.json | 20 ++++++ .../green66.colorset/Contents.json | 20 ++++++ .../greenInverted.colorset/Contents.json | 20 ++++++ .../greenShade2.colorset/Contents.json | 20 ++++++ .../orange.colorset/Contents.json | 20 ++++++ .../orange33.colorset/Contents.json | 20 ++++++ .../orange66.colorset/Contents.json | 20 ++++++ .../orangeAA.colorset/Contents.json | 20 ++++++ .../orangeShade1.colorset/Contents.json | 20 ++++++ .../orangeShade2.colorset/Contents.json | 20 ++++++ .../pink.colorset/Contents.json | 20 ++++++ .../pink33.colorset/Contents.json | 20 ++++++ .../pink66.colorset/Contents.json | 20 ++++++ .../pinkShade1.colorset/Contents.json | 20 ++++++ .../pinkShade2.colorset/Contents.json | 20 ++++++ .../purple.colorset/Contents.json | 20 ++++++ .../purple33.colorset/Contents.json | 20 ++++++ .../purple66.colorset/Contents.json | 20 ++++++ .../purpleShade1.colorset/Contents.json | 20 ++++++ .../purpleShade2.colorset/Contents.json | 20 ++++++ .../red.colorset/Contents.json | 20 ++++++ .../upGold1.colorset/Contents.json | 20 ++++++ .../upGold2.colorset/Contents.json | 20 ++++++ .../upGold3.colorset/Contents.json | 20 ++++++ .../yellow.colorset/Contents.json | 20 ++++++ 39 files changed, 766 insertions(+), 36 deletions(-) create mode 100644 MVMCoreUI/Categories/colors.xcassets/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json create mode 100644 MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 3af65c10..3a9c7efe 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -80,6 +80,7 @@ 0A6682B5243769C700AD3CA1 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6682B3243769C700AD3CA1 /* TextView.swift */; }; 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; }; 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; }; + 0A6C1FC324927E2E00E64B52 /* colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0A6C1FC224927E2E00E64B52 /* colors.xcassets */; }; 0A775F2624893916009EFB58 /* ThreeHeadlineBodyLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */; }; 0A775F2824893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */; }; 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; }; @@ -521,6 +522,7 @@ 0A6682B3243769C700AD3CA1 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyRequiredModel.swift; sourceTree = ""; }; 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDropdownEntryField.swift; sourceTree = ""; }; + 0A6C1FC224927E2E00E64B52 /* colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = colors.xcassets; path = MVMCoreUI/Categories/colors.xcassets; sourceTree = SOURCE_ROOT; }; 0A775F2524893916009EFB58 /* ThreeHeadlineBodyLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLink.swift; sourceTree = ""; }; 0A775F2724893937009EFB58 /* ThreeHeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeHeadlineBodyLinkModel.swift; sourceTree = ""; }; 0A7918F423F5E7EA00772FF4 /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = ""; }; @@ -1818,6 +1820,7 @@ D29DF26621E6A9E4003B2FB9 /* ThirdParty */, D29DF31521ECECC0003B2FB9 /* Fonts */, D29DF32D21EE8C3D003B2FB9 /* Media.xcassets */, + 0A6C1FC224927E2E00E64B52 /* colors.xcassets */, ); path = SupportingFiles; sourceTree = ""; @@ -2036,6 +2039,7 @@ files = ( 94CA227C24058534002D6750 /* VerizonNHGeTX-Bold.otf in Resources */, D29DF32C21EE8736003B2FB9 /* Localizable.strings in Resources */, + 0A6C1FC324927E2E00E64B52 /* colors.xcassets in Resources */, 94CA227D24058534002D6750 /* VerizonNHGeDS-Regular.otf in Resources */, D29DF32E21EE8C3D003B2FB9 /* Media.xcassets in Resources */, 94CA227E24058534002D6750 /* VerizonNHGeDS-Bold.otf in Resources */, diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 7c82788c..e04a7d46 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -71,144 +71,144 @@ extension UIColor { //-------------------------------------------------- /// HEX: #D52B1E - public static let mvmRed = UIColor.color8Bits(red: 213, green: 43, blue: 30) + public static let mvmRed = UIColor(named: "red")! //-------------------------------------------------- // MARK: - Pink //-------------------------------------------------- /// HEX: #D90368 - public static let mvmPink = UIColor.color8Bits(red: 217, green: 3, blue: 104) + public static let mvmPink = UIColor(named: "pink")! /// HEX: #F2ABCD - public static let mvmPink33 = UIColor.color8Bits(red: 242, green: 171, blue: 205) + public static let mvmPink33 = UIColor(named: "pink33")! /// HEX: #E6589B - public static let mvmPink66 = UIColor.color8Bits(red: 230, green: 88, blue: 155) + public static let mvmPink66 = UIColor(named: "pink66")! /// HEX: #B31C63 - public static let mvmPinkShade1 = UIColor.color8Bits(red: 179, green: 28, blue: 99) + public static let mvmPinkShade1 = UIColor(named: "pinkShade1")! /// HEX: #830842 - public static let mvmPinkShade2 = UIColor.color8Bits(red: 131, green: 8, blue: 66) + public static let mvmPinkShade2 = UIColor(named: "pinkShade2")! //-------------------------------------------------- // MARK: - Purple //-------------------------------------------------- /// HEX: #8C00AC - public static let mvmPurple = UIColor.color8Bits(red: 140, green: 0, blue: 172) + public static let mvmPurple = UIColor(named: "purple")! /// HEX: #D9ABE4 - public static let mvmPurple33 = UIColor.color8Bits(red: 217, green: 171, blue: 228) + public static let mvmPurple33 = UIColor(named: "purple33")! /// HEX: #B356C8 - public static let mvmPurple66 = UIColor.color8Bits(red: 179, green: 86, blue: 200) + public static let mvmPurple66 = UIColor(named: "purple66")! /// HEX: #6C177F - public static let mvmPurpleShade1 = UIColor.color8Bits(red: 108, green: 23, blue: 127) + public static let mvmPurpleShade1 = UIColor(named: "purpleShade1")! /// HEX: #4A0E58 - public static let mvmPurpleShade2 = UIColor.color8Bits(red: 74, green: 14, blue: 88) + public static let mvmPurpleShade2 = UIColor(named: "purpleShade2")! //-------------------------------------------------- // MARK: - Orange //-------------------------------------------------- /// HEX: #ED7000 - public static let mvmOrange = UIColor.color8Bits(red: 237, green: 112, blue: 0) + public static let mvmOrange = UIColor(named: "orange")! /// HEX: #CC4D0F - public static let mvmOrangeAA = UIColor.color8Bits(red: 204, green: 77, blue: 15) + public static let mvmOrangeAA = UIColor(named: "orangeAA")! /// HEX: #F9D0AB - public static let mvmOrange33 = UIColor.color8Bits(red: 249, green: 208, blue: 171) + public static let mvmOrange33 = UIColor(named: "orange33")! /// HEX: #F3A157 - public static let mvmOrange66 = UIColor.color8Bits(red: 243, green: 161, blue: 87) + public static let mvmOrange66 = UIColor(named: "orange66")! /// HEX: #CB5F00 - public static let mvmOrangeShade1 = UIColor.color8Bits(red: 203, green: 95, blue: 0) + public static let mvmOrangeShade1 = UIColor(named: "orangeShade1")! /// HEX: #984700 - public static let mvmOrangeShade2 = UIColor.color8Bits(red: 152, green: 71, blue: 0) + public static let mvmOrangeShade2 = UIColor(named: "orangeShade2")! //-------------------------------------------------- // MARK: - Green //-------------------------------------------------- /// HEX: #008330 - public static let mvmGreen = UIColor.color8Bits(red: 0, green: 134, blue: 48) + public static let mvmGreen = UIColor(named: "green")! /// HEX: #ABE4BF - public static let mvmGreen33 = UIColor.color8Bits(red: 171, green: 228, blue: 191) + public static let mvmGreen33 = UIColor(named: "green33")! /// HEX: #57C880 - public static let mvmGreen66 = UIColor.color8Bits(red: 87, green: 200, blue: 128) + public static let mvmGreen66 = UIColor(named: "green66")! /// HEX: #0F5B25 - public static let mvmGreenShade2 = UIColor.color8Bits(red: 15, green: 91, blue: 37) + public static let mvmGreenShade2 = UIColor(named: "greenShade2")! /// HEX: #00AC3E - public static let mvmGreenInverted = UIColor.color8Bits(red: 0, green: 172, blue: 62) + public static let mvmGreenInverted = UIColor(named: "greenInverted")! //-------------------------------------------------- // MARK: - Blue //-------------------------------------------------- /// HEX: #0077B4 - public static let mvmBlue = UIColor.color8Bits(red: 0, green: 119, blue: 180) + public static let mvmBlue = UIColor(named: "blue")! /// HEX: #ABD8EF - public static let mvmBlue33 = UIColor.color8Bits(red: 171, green: 216, blue: 239) + public static let mvmBlue33 = UIColor(named: "blue33")! /// HEX: #57B1DF - public static let mvmBlue66 = UIColor.color8Bits(red: 87, green: 177, blue: 223) + public static let mvmBlue66 = UIColor(named: "blue66")! /// HEX: #136598 - public static let mvmBlueShade1 = UIColor.color8Bits(red: 19, green: 101, blue: 152) + public static let mvmBlueShade1 = UIColor(named: "blueShade1")! /// HEX: #0B4467 - public static let mvmBlueShade2 = UIColor.color8Bits(red: 11, green: 68, blue: 103) + public static let mvmBlueShade2 = UIColor(named: "blueShade2")! /// HEX: #0088CE - public static let mvmBlueInverted = UIColor.color8Bits(red: 0, green: 136, blue: 206) + public static let mvmBlueInverted = UIColor(named: "blueInverted")! //-------------------------------------------------- // MARK: - Yellow //-------------------------------------------------- /// HEX: #FFBC3D - public static let mvmYellow = UIColor.color8Bits(red: 255, green: 188, blue: 61) + public static let mvmYellow = UIColor(named: "yellow")! //-------------------------------------------------- // MARK: - Gray //-------------------------------------------------- /// HEX: #F6F6F6 - public static let mvmCoolGray1 = UIColor.grayscale(rgb: 246) + public static let mvmCoolGray1 = UIColor(named: "coolGray1")! /// HEX: #D8DADA - public static let mvmCoolGray3 = UIColor.color8Bits(red: 216, green: 218, blue: 218) + public static let mvmCoolGray3 = UIColor(named: "coolGray3")! /// HEX: #747676 - public static let mvmCoolGray6 = UIColor.color8Bits(red: 116, green: 118, blue: 118) + public static let mvmCoolGray6 = UIColor(named: "coolGray6")! /// HEX: #333333 - public static let mvmCoolGray10 = UIColor.grayscale(rgb: 51) + public static let mvmCoolGray10 = UIColor(named: "coolGray10")! //-------------------------------------------------- // MARK: - VZ UP Brand //-------------------------------------------------- /// HEX: #F9D542 - public static let vzupGold1 = UIColor.color8Bits(red: 249, green: 213, blue: 66) + public static let vzupGold1 = UIColor(named: "upGold1")! /// HEX: #F4CA53 - public static let vzupGold2 = UIColor.color8Bits(red: 244, green: 202, blue: 83) + public static let vzupGold2 = UIColor(named: "upGold2")! /// HEX: #CC9B2D - public static let vzupGold3 = UIColor.color8Bits(red: 204, green: 155, blue: 45) + public static let vzupGold3 = UIColor(named: "upGold3")! //-------------------------------------------------- // MARK: - Functions diff --git a/MVMCoreUI/Categories/colors.xcassets/Contents.json b/MVMCoreUI/Categories/colors.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json new file mode 100644 index 00000000..8629132f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0xB4", + "green" : "0x77" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json new file mode 100644 index 00000000..834857fe --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xAB", + "alpha" : "1.000", + "blue" : "0xEF", + "green" : "0xD8" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json new file mode 100644 index 00000000..37fcdd6f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blue66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x57", + "alpha" : "1.000", + "blue" : "0xDF", + "green" : "0xB1" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json new file mode 100644 index 00000000..ca54d6ce --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueInverted.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0xCE", + "green" : "0x88" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json new file mode 100644 index 00000000..0153330a --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x13", + "alpha" : "1.000", + "blue" : "0x98", + "green" : "0x65" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json new file mode 100644 index 00000000..bae4fe1c --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/blueShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x0B", + "alpha" : "1.000", + "blue" : "0x67", + "green" : "0x44" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json new file mode 100644 index 00000000..18db9a3d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF6", + "alpha" : "1.000", + "blue" : "0xF6", + "green" : "0xF6" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json new file mode 100644 index 00000000..f9b0b98b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray10.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x33", + "alpha" : "1.000", + "blue" : "0x33", + "green" : "0x33" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json new file mode 100644 index 00000000..3082b216 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD8", + "alpha" : "1.000", + "blue" : "0xDA", + "green" : "0xDA" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json new file mode 100644 index 00000000..3c1ebf6d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/coolGray6.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x74", + "alpha" : "1.000", + "blue" : "0x76", + "green" : "0x76" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json new file mode 100644 index 00000000..40987eb7 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x30", + "green" : "0x83" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json new file mode 100644 index 00000000..63d79fa1 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xAB", + "alpha" : "1.000", + "blue" : "0xBF", + "green" : "0xE4" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json new file mode 100644 index 00000000..af8c1094 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/green66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x57", + "alpha" : "1.000", + "blue" : "0x80", + "green" : "0xC8" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json new file mode 100644 index 00000000..b2a48b0f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/greenInverted.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x3E", + "green" : "0xAC" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json new file mode 100644 index 00000000..00dc90da --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/greenShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x0F", + "alpha" : "1.000", + "blue" : "0x25", + "green" : "0x5B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json new file mode 100644 index 00000000..e5415e4b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xED", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x70" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json new file mode 100644 index 00000000..4c9e04e4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF9", + "alpha" : "1.000", + "blue" : "0xAB", + "green" : "0xD0" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json new file mode 100644 index 00000000..67424977 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orange66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF3", + "alpha" : "1.000", + "blue" : "0x57", + "green" : "0xA1" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json new file mode 100644 index 00000000..56f98a12 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeAA.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCC", + "alpha" : "1.000", + "blue" : "0x0F", + "green" : "0x4D" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json new file mode 100644 index 00000000..6cf34c78 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCB", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x5F" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json new file mode 100644 index 00000000..1fcbe3a4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/orangeShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x98", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x47" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json new file mode 100644 index 00000000..4cc87bd4 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD9", + "alpha" : "1.000", + "blue" : "0x68", + "green" : "0x03" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json new file mode 100644 index 00000000..2d85dd8f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF2", + "alpha" : "1.000", + "blue" : "0xCD", + "green" : "0xAB" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json new file mode 100644 index 00000000..c05eef33 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pink66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xE6", + "alpha" : "1.000", + "blue" : "0x9B", + "green" : "0x58" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json new file mode 100644 index 00000000..59e8780d --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pinkShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xB3", + "alpha" : "1.000", + "blue" : "0x63", + "green" : "0x1C" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json new file mode 100644 index 00000000..1dcdecbe --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/pinkShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x83", + "alpha" : "1.000", + "blue" : "0x42", + "green" : "0x08" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json new file mode 100644 index 00000000..49d87c9e --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x8C", + "alpha" : "1.000", + "blue" : "0xAC", + "green" : "0x00" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json new file mode 100644 index 00000000..95cac70e --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple33.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD9", + "alpha" : "1.000", + "blue" : "0xE4", + "green" : "0xAB" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json new file mode 100644 index 00000000..95e75564 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purple66.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xB3", + "alpha" : "1.000", + "blue" : "0xC8", + "green" : "0x56" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json new file mode 100644 index 00000000..689b7838 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purpleShade1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x6C", + "alpha" : "1.000", + "blue" : "0x7F", + "green" : "0x17" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json new file mode 100644 index 00000000..d71ec372 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/purpleShade2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x4A", + "alpha" : "1.000", + "blue" : "0x58", + "green" : "0x0E" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json new file mode 100644 index 00000000..536ccc9b --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/red.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xD5", + "alpha" : "1.000", + "blue" : "0x1E", + "green" : "0x2B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json new file mode 100644 index 00000000..90ccb299 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold1.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF9", + "alpha" : "1.000", + "blue" : "0x42", + "green" : "0xD5" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json new file mode 100644 index 00000000..6389c7a8 --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold2.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xF4", + "alpha" : "1.000", + "blue" : "0x53", + "green" : "0xCA" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json new file mode 100644 index 00000000..e25cb46f --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/upGold3.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xCC", + "alpha" : "1.000", + "blue" : "0x2D", + "green" : "0x9B" + } + } + } + ] +} \ No newline at end of file diff --git a/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json b/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json new file mode 100644 index 00000000..5c00b5eb --- /dev/null +++ b/MVMCoreUI/Categories/colors.xcassets/yellow.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xFF", + "alpha" : "1.000", + "blue" : "0x3D", + "green" : "0xBC" + } + } + } + ] +} \ No newline at end of file From e4384066ae1615e36f1d5cefa6e20314a9e52a8a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 15 Jun 2020 11:36:42 -0400 Subject: [PATCH 15/42] opening diameter for dev --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 38 ++++++++++++++----- .../Atoms/Views/LoadingSpinnerModel.swift | 4 ++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 17be8ba2..b3224f68 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -19,6 +19,13 @@ open class LoadingSpinner: View { public var lineWidth: CGFloat = 3.0 public var speed: Float = 1.5 + + //-------------------------------------------------- + // MARK: - Constraints + //-------------------------------------------------- + + public var heightConstraint: NSLayoutConstraint? + public var widthConstraint: NSLayoutConstraint? //-------------------------------------------------- // MARK: - Lifecycle @@ -41,8 +48,19 @@ open class LoadingSpinner: View { layer.speed = speed let halfWidth = lineWidth / 2 let radius = (bounds.width - lineWidth) / 2 - layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, y: radius + halfWidth), radius: radius, startAngle: -CGFloat.pi / 2, endAngle: 2 * CGFloat.pi, clockwise: true).cgPath - + layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, + y: radius + halfWidth), + radius: radius, + startAngle: -CGFloat.pi / 2, + endAngle: 2 * CGFloat.pi, + clockwise: true).cgPath + } + + public override func reset() { + super.reset() + + heightConstraint?.isActive = false + widthConstraint?.isActive = false } //-------------------------------------------------- @@ -152,14 +170,12 @@ open class LoadingSpinner: View { layer.removeAllAnimations() } - func pinWidthAndHeight(radius: CGFloat) { + func pinWidthAndHeight(diameter: CGFloat) { - let diameter: CGFloat = radius * 2 + lineWidth - - NSLayoutConstraint.activate([ - heightAnchor.constraint(equalToConstant: diameter), - widthAnchor.constraint(equalToConstant: diameter) - ]) + heightConstraint = heightAnchor.constraint(equalToConstant: diameter + lineWidth) + widthConstraint = widthAnchor.constraint(equalToConstant: diameter + lineWidth) + heightConstraint?.isActive = true + widthConstraint?.isActive = true } //-------------------------------------------------- @@ -172,6 +188,10 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth + + if let diameter = model.diameter { + pinWidthAndHeight(diameter: diameter) + } } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift index 604c0689..ef299d46 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift @@ -18,6 +18,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { public static var identifier: String = "loadingSpinner" public var strokeColor = Color(uiColor: .mvmBlack) public var lineWidth: CGFloat = 3 + public var diameter: CGFloat? //-------------------------------------------------- // MARK: - Keys @@ -28,6 +29,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { case backgroundColor case strokeColor case lineWidth + case diameter } //-------------------------------------------------- @@ -38,6 +40,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) { self.strokeColor = strokeColor @@ -52,6 +55,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encodeIfPresent(diameter, forKey: .diameter) try container.encode(strokeColor, forKey: .strokeColor) try container.encode(lineWidth, forKey: .lineWidth) } From a03b50865f1c6af3400f29e2de3aa7be687caabd Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 19 Jun 2020 10:58:59 -0400 Subject: [PATCH 16/42] default dimension --- .../Atomic/Atoms/Views/LoadingSpinner.swift | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index b3224f68..7f7007b2 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -26,7 +26,7 @@ open class LoadingSpinner: View { public var heightConstraint: NSLayoutConstraint? public var widthConstraint: NSLayoutConstraint? - + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- @@ -39,6 +39,13 @@ open class LoadingSpinner: View { return CAShapeLayer.self } + open override func setupView() { + super.setupView() + + heightConstraint = heightAnchor.constraint(equalToConstant: 0) + widthConstraint = widthAnchor.constraint(equalToConstant: 0) + } + override open func layoutSubviews() { super.layoutSubviews() layer.fillColor = nil @@ -172,8 +179,9 @@ open class LoadingSpinner: View { func pinWidthAndHeight(diameter: CGFloat) { - heightConstraint = heightAnchor.constraint(equalToConstant: diameter + lineWidth) - widthConstraint = widthAnchor.constraint(equalToConstant: diameter + lineWidth) + let dimension = diameter + lineWidth + heightConstraint?.constant = dimension + widthConstraint?.constant = dimension heightConstraint?.isActive = true widthConstraint?.isActive = true } @@ -188,10 +196,7 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth - - if let diameter = model.diameter { - pinWidthAndHeight(diameter: diameter) - } + pinWidthAndHeight(diameter: model.diameter ?? 40) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From 572968f19383acfd042aaaf64cc0171aeec44592 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 19 Jun 2020 10:59:53 -0400 Subject: [PATCH 17/42] default dimension --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 7f7007b2..36476a68 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -20,6 +20,8 @@ open class LoadingSpinner: View { public var speed: Float = 1.5 + public var defaultDimension: CGFloat = 40 + //-------------------------------------------------- // MARK: - Constraints //-------------------------------------------------- @@ -196,7 +198,7 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth - pinWidthAndHeight(diameter: model.diameter ?? 40) + pinWidthAndHeight(diameter: model.diameter ?? defaultDimension) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From 77c6396034981c278a9efbb5d927728f34e7ad25 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 19 Jun 2020 11:17:02 -0400 Subject: [PATCH 18/42] default --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 4 +--- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 36476a68..bfc47613 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -20,8 +20,6 @@ open class LoadingSpinner: View { public var speed: Float = 1.5 - public var defaultDimension: CGFloat = 40 - //-------------------------------------------------- // MARK: - Constraints //-------------------------------------------------- @@ -198,7 +196,7 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth - pinWidthAndHeight(diameter: model.diameter ?? defaultDimension) + pinWidthAndHeight(diameter: model.diameter) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift index ef299d46..aab510a4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift @@ -18,7 +18,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { public static var identifier: String = "loadingSpinner" public var strokeColor = Color(uiColor: .mvmBlack) public var lineWidth: CGFloat = 3 - public var diameter: CGFloat? + public var diameter: CGFloat = 40 //-------------------------------------------------- // MARK: - Keys @@ -40,7 +40,10 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) + + if let diameter = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .diameter) { + self.diameter = diameter + } if let strokeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .strokeColor) { self.strokeColor = strokeColor From a826ce96c0973be228e35ebbd9311fbb203b3f35 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 16:16:26 -0400 Subject: [PATCH 19/42] update width of line --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift index aab510a4..bdef3c86 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinnerModel.swift @@ -17,7 +17,7 @@ open class LoadingSpinnerModel: MoleculeModelProtocol { public var backgroundColor: Color? public static var identifier: String = "loadingSpinner" public var strokeColor = Color(uiColor: .mvmBlack) - public var lineWidth: CGFloat = 3 + public var lineWidth: CGFloat = 4 public var diameter: CGFloat = 40 //-------------------------------------------------- From 55af2346eb99d458993303868ea377163466cbfb Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 25 Jun 2020 16:16:47 -0400 Subject: [PATCH 20/42] update width of line --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index bfc47613..ae9cce75 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -16,7 +16,7 @@ open class LoadingSpinner: View { public var strokeColor: UIColor = .mvmBlack - public var lineWidth: CGFloat = 3.0 + public var lineWidth: CGFloat = 4.0 public var speed: Float = 1.5 From 3eb6f6c6901df7df4f3792167fe1568e32863605 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:57:42 -0400 Subject: [PATCH 21/42] open list page template model for outside extension. --- MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift | 6 +++--- MVMCoreUI/Atomic/Templates/TemplateModel.swift | 3 ++- MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift index b239bd81..b2b52573 100644 --- a/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift @@ -8,12 +8,12 @@ import Foundation -@objcMembers public class ListPageTemplateModel: ThreeLayerModelBase { +@objcMembers open class ListPageTemplateModel: ThreeLayerModelBase { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public override class var identifier: String { + open override class var identifier: String { return "list" } public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]? @@ -49,7 +49,7 @@ import Foundation try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + open override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeModelsIfPresent(molecules, forKey: .molecules) diff --git a/MVMCoreUI/Atomic/Templates/TemplateModel.swift b/MVMCoreUI/Atomic/Templates/TemplateModel.swift index 01753414..bb8bb104 100644 --- a/MVMCoreUI/Atomic/Templates/TemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/TemplateModel.swift @@ -9,7 +9,8 @@ import Foundation -@objcMembers public class TemplateModel: MVMControllerModelProtocol, TabPageModelProtocol { +@objcMembers open class TemplateModel: MVMControllerModelProtocol, TabPageModelProtocol { + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift b/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift index f0276979..1120b0e7 100644 --- a/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift +++ b/MVMCoreUI/Atomic/Templates/ThreeLayerModelBase.swift @@ -8,7 +8,7 @@ import Foundation -@objcMembers public class ThreeLayerModelBase: TemplateModel, ThreeLayerTemplateModelProtocol { +@objcMembers open class ThreeLayerModelBase: TemplateModel, ThreeLayerTemplateModelProtocol { public var anchorHeader: Bool = false public var header: MoleculeModelProtocol? public var anchorFooter: Bool = false From 3edb3dcfe246ee7b19019f03c639b0b272fe9b65 Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:58:11 -0400 Subject: [PATCH 22/42] toggle alternateAction handling. --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 2e50dfca..87373ff4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -392,8 +392,23 @@ public typealias ActionBlockConfirmation = () -> (Bool) accessibilityLabel = accessibileString } - if let actionMap = model.action?.toJSON() { - didToggleAction = { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } + let actionMap = model.action?.toJSON() + let alternateActionMap = model.alternateAction?.toJSON() + if actionMap != nil || alternateActionMap != nil { + didToggleAction = { [weak self] in + guard let strongSelf = self else { return } + if strongSelf.isOn { + if actionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + } + } else { + if alternateActionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: alternateActionMap, additionalData: additionalData, delegateObject: delegateObject) + } else if actionMap != nil { + MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) + } + } + } } } From 1337e87c3de64703292e057a7033f6e0bf4bd65d Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 08:59:01 -0400 Subject: [PATCH 23/42] move decoding logic to ViewController for overrides. --- MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift | 6 ++++-- MVMCoreUI/BaseControllers/ViewController.swift | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 04280042..4e6d5d32 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -14,13 +14,15 @@ public protocol TemplateProtocol: AnyObject { } public extension TemplateProtocol where Self: ViewController { + func parseTemplate(json: [AnyHashable: Any]?) throws { guard let pageJSON = json else { return } let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel = try decoder.decode(TemplateModel.self, from: data) - self.templateModel = templateModel + let templateModel = try decodeTemplate(using: decoder, from: data) + self.templateModel = templateModel as? TemplateModel self.pageModel = templateModel as? MVMControllerModelProtocol } + } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6e1b35ff..df604d82 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -130,6 +130,10 @@ import UIKit open func parsePageJSON() throws { } + open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { + return try decoder.decode(TemplateModel.self, from: data) + } + open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: AutoreleasingUnsafeMutablePointer) -> Bool { guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType), !modulesRequired.isEmpty else { return true } From 0cb184a41b187876e3468193a37bc91be7ac56bb Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Fri, 26 Jun 2020 20:00:54 -0400 Subject: [PATCH 24/42] Fix methodology of template model subclassing. --- MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift | 13 +++++++++++-- MVMCoreUI/BaseControllers/ViewController.swift | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 4e6d5d32..699c217c 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -13,6 +13,10 @@ public protocol TemplateProtocol: AnyObject { var templateModel: TemplateModel? { get set } } +public protocol CustomTemplateDecoder { + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModelProtocol +} + public extension TemplateProtocol where Self: ViewController { func parseTemplate(json: [AnyHashable: Any]?) throws { @@ -20,8 +24,13 @@ public extension TemplateProtocol where Self: ViewController { let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel = try decodeTemplate(using: decoder, from: data) - self.templateModel = templateModel as? TemplateModel + let templateModel: TemplateModel + if let customDecoder = self as? CustomTemplateDecoder { + templateModel = try customDecoder.decodeTemplate(using: decoder, from: data) as! Self.TemplateModel + } else { + templateModel = try decoder.decode(TemplateModel.self, from: data) + } + self.templateModel = templateModel self.pageModel = templateModel as? MVMControllerModelProtocol } diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index df604d82..bd8c66f9 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -129,10 +129,6 @@ import UIKit open func parsePageJSON() throws { } - - open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { - return try decoder.decode(TemplateModel.self, from: data) - } open class func verifyRequiredModulesLoaded(for loadObject: MVMCoreLoadObject?, error: AutoreleasingUnsafeMutablePointer) -> Bool { guard let pageType = loadObject?.pageType, var modulesRequired = MVMCoreUIViewControllerMappingObject.shared()?.modulesRequired(forPageType: pageType), From e7c7351840b3e952ded3a2b9b6d993f61cb103e6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 11:01:17 -0400 Subject: [PATCH 25/42] separating navigation item setters --- .../BaseControllers/ViewController.swift | 50 +++++++++++++------ .../Containers/NavigationController.swift | 32 +++++++----- ...MCoreUISplitViewController+Extension.swift | 6 +-- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6e1b35ff..6a585dab 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -94,9 +94,10 @@ import UIKit try parsePageJSON() MVMCoreDispatchUtility.performBlock(onMainThread: { self.handleNewDataAndUpdateUI() - // If the screen is showing, can update the navigation controller. - if MVMCoreUIUtility.getCurrentVisibleController() == self.manager ?? self { - self.setNavigationController() + + // Update navigation bar if showing. + if MVMCoreUIUtility.getCurrentVisibleController() == self { + self.setNavigationBar() } }) } catch { @@ -168,12 +169,6 @@ import UIKit /// Processes any new data. Called after the page is loaded the first time and on response updates for this page, open func handleNewData() { - // TODO: remove legacy. Temporary, convert legacy to navigation model. - if pageModel?.navigationBar == nil { - let navigationItem = createDefaultLegacyNavigationModel() - pageModel?.navigationBar = navigationItem - } - if formValidator == nil { let rules = pageModel?.formRules formValidator = FormValidator(rules) @@ -182,20 +177,43 @@ import UIKit if let backgroundColor = pageModel?.backgroundColor { view.backgroundColor = backgroundColor.uiColor } + + // Sets up the navigation item based on the data. + setNavigationItem() } // MARK: - Navigation Item (Move to model base) - open func setNavigationController() { + + open func getNavigationModel() -> NavigationItemModelProtocol? { + // TODO: remove legacy. Temporary, convert legacy to navigation model. + if pageModel?.navigationBar == nil { + let navigationItem = createDefaultLegacyNavigationModel() + pageModel?.navigationBar = navigationItem + } + return pageModel?.navigationBar + } + + /// Sets the navigation item for this view controller. + open func setNavigationItem() { + guard let navigationItemModel = getNavigationModel(), + let navigationController = navigationController else { return } + + // We additionally want our left items + navigationItem.leftItemsSupplementBackButton = true + + // Utilize helper function to set the navigation item state. + NavigationController.setNavigationItem(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: self) + } + + /// Sets the appearance of the navigation bar based on the model. + open func setNavigationBar() { let viewController = manager ?? self - guard let navigationItemModel = pageModel?.navigationBar, + guard let navigationItemModel = getNavigationModel(), let navigationController = viewController.navigationController else { MVMCoreUISession.sharedGlobal()?.splitViewController?.parent?.setNeedsStatusBarAppearanceUpdate() return } - // We additionally want our left items - navigationItem.leftItemsSupplementBackButton = true - // Utilize helper function to set the split view and navigation item state. MVMCoreUISplitViewController.setSplitViewController(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: isMasterInitiallyAccessible(), rightPanelAccessible: isSupportInitiallyAccessible(), progress: bottomProgress() ?? 0) } @@ -308,7 +326,7 @@ import UIKit open func pageShown() { // Update the navigation bar ui when view is appearing. - setNavigationController() + setNavigationBar() // Update tab if needed. updateTabBar() @@ -425,7 +443,7 @@ import UIKit // Reset the navigation state. public func splitViewDidReset() { - setNavigationController() + setNavigationBar() } // MARK: - UITextFieldDelegate (Check if this is still needed) diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 12d70634..a412728b 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -43,6 +43,14 @@ import UIKit return navigationController } + /// Convenience function for setting the navigation item. + public static func setNavigationItem(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + viewController.navigationItem.title = navigationItemModel.title + viewController.navigationItem.accessibilityLabel = navigationItemModel.title + viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil) + setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + } + /// Convenience function for setting the navigation buttons. public static func setNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject @@ -68,11 +76,7 @@ import UIKit } /// Convenience function for setting the navigation bar ui, except for the buttons. - public static func setNavigationUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - viewController.navigationItem.title = navigationItemModel.title - viewController.navigationItem.accessibilityLabel = navigationItemModel.title - viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil) - + public static func setNavigationBarUI(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true) navigationController.navigationBar.barTintColor = navigationItemModel.backgroundColor?.uiColor ?? .white @@ -88,17 +92,19 @@ import UIKit } } - /// Convenience function for setting navigation bar with model. - public static func set(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { - setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) - } - /// Convenience setter for legacy files - public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { + public static func setNavigationItem(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") } - set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) + setNavigationItem(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) + } + + /// Convenience setter for legacy files + public static func setNavigationBarUI(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws { + guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { + throw ModelRegistry.Error.decoderOther(message: "Model not a bar model") + } + setNavigationBarUI(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController) } } diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index bfbe19ac..059723a6 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -15,7 +15,7 @@ public extension MVMCoreUISplitViewController { guard let splitView = MVMCoreUISplitViewController.main(), navigationController == splitView.navigationController, navigationController.topViewController == viewController else { - NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) return } splitView.set(for: viewController, navigationController: navigationController, navigationItemModel: navigationItemModel, leftPanelAccessible: leftPanelAccessible, rightPanelAccessible: rightPanelAccessible, progress: progress) @@ -27,7 +27,7 @@ public extension MVMCoreUISplitViewController { // Setup the panels. setupPanels() - NavigationController.setNavigationUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) setLeftPanelIsAccessible(leftPanelAccessible ?? leftPanelIsAccessible, for: viewController, updateNavigationButtons: false) setRightPanelIsAccessible(rightPanelAccessible ?? rightPanelIsAccessible, for: viewController, updateNavigationButtons: false) @@ -115,7 +115,7 @@ public extension MVMCoreUISplitViewController { guard let splitView = MVMCoreUISplitViewController.main(), navigationController == splitView.navigationController, navigationController.topViewController == viewController else { - NavigationController.set(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) + NavigationController.setNavigationBarUI(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) return } let progress = progress?.floatValue From d1df1e2944696e6c88eee0c90cbff2645ac89c9a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 19:54:00 -0400 Subject: [PATCH 26/42] feedback --- .../MVMCoreUISplitViewController+Extension.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index 963834ff..e9d0eb65 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -43,14 +43,14 @@ public extension MVMCoreUISplitViewController { } /// Sets the left navigation items for the view controller based on model and splitview. - func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { var leftItems: [UIBarButtonItem] = [] let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if navigationItemModel?.alwaysShowBackButton != false { - if let backButtonModel = navigationItemModel?.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { + if navigationItemModel.alwaysShowBackButton ?? false != false { + if let backButtonModel = navigationItemModel.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } } else if let backButton = backButton, @@ -67,7 +67,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let leftItemModels = navigationItemModel?.additionalLeftButtons { + if let leftItemModels = navigationItemModel.additionalLeftButtons { for item in leftItemModels { leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } @@ -82,7 +82,7 @@ public extension MVMCoreUISplitViewController { } /// Sets the right navigation items for the view controller based on model and splitview. - func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { + func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var rightItems: [UIBarButtonItem] = [] @@ -94,7 +94,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let rightItemModels = navigationItemModel?.additionalRightButtons { + if let rightItemModels = navigationItemModel.additionalRightButtons { for item in rightItemModels { rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } From c599f314c39580895a6f2f3ea68a52126eaf9984 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 29 Jun 2020 19:58:34 -0400 Subject: [PATCH 27/42] undo changes --- .../MVMCoreUISplitViewController+Extension.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift index e9d0eb65..963834ff 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController+Extension.swift @@ -43,14 +43,14 @@ public extension MVMCoreUISplitViewController { } /// Sets the left navigation items for the view controller based on model and splitview. - func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + func setLeftNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { var leftItems: [UIBarButtonItem] = [] let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject // Add back button first. - if navigationItemModel.alwaysShowBackButton ?? false != false { - if let backButtonModel = navigationItemModel.backButton { - if navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton ?? false { + if navigationItemModel?.alwaysShowBackButton != false { + if let backButtonModel = navigationItemModel?.backButton { + if navigationController.viewControllers.count > 1 || navigationItemModel!.alwaysShowBackButton ?? false { leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } } else if let backButton = backButton, @@ -67,7 +67,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let leftItemModels = navigationItemModel.additionalLeftButtons { + if let leftItemModels = navigationItemModel?.additionalLeftButtons { for item in leftItemModels { leftItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } @@ -82,7 +82,7 @@ public extension MVMCoreUISplitViewController { } /// Sets the right navigation items for the view controller based on model and splitview. - func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol, viewController: UIViewController) { + func setRightNavigationButtons(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) { let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject var rightItems: [UIBarButtonItem] = [] @@ -94,7 +94,7 @@ public extension MVMCoreUISplitViewController { } // Add other model buttons - if let rightItemModels = navigationItemModel.additionalRightButtons { + if let rightItemModels = navigationItemModel?.additionalRightButtons { for item in rightItemModels { rightItems.append(item.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) } From 51c243d059ddb81c0bd90166c5342d566d7bbe19 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 1 Jul 2020 17:03:40 +0530 Subject: [PATCH 28/42] 21522(iOS - Headers - H2 - Caret Link) story initial commit. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Headers/H2/HeadersH2CaretLink.swift | 58 ++++++++++++++++ .../Headers/H2/HeadersH2CaretLinkModel.swift | 66 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9ebcf41d..f280c4c6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -225,6 +225,8 @@ AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; }; AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; }; AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; }; + AAE7270C24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */; }; + AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */; }; BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; @@ -683,6 +685,8 @@ AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = ""; }; AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = ""; }; AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = ""; }; + AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLinkModel.swift; sourceTree = ""; }; + AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2CaretLink.swift; sourceTree = ""; }; BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = ""; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = ""; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = ""; }; @@ -1531,6 +1535,8 @@ AA633B3224989ED500731E80 /* HeadersH2PricingTwoRows.swift */, AA71AD3D24A32FCE00ACA76F /* HeadersH2LinkModel.swift */, AA71AD3F24A32FE700ACA76F /* HeadersH2Link.swift */, + AAE7270B24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift */, + AAE7270D24AC8B9300A3ED0E /* HeadersH2CaretLink.swift */, ); path = H2; sourceTree = ""; @@ -2369,6 +2375,7 @@ 279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */, BB6C6AC0242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift in Sources */, 8DEFA95E243DAC2F000D27E5 /* ListThreeColumnDataUsageDivider.swift in Sources */, + AAE7270E24AC8B9300A3ED0E /* HeadersH2CaretLink.swift in Sources */, D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, 324FB6AC24936717002552C7 /* ListLeftVariableNumberedListBodyText.swift in Sources */, AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */, @@ -2470,6 +2477,7 @@ D264FA90243BCE6800D98315 /* ThreeLayerCollectionViewController.swift in Sources */, AA104B1C24474A76004D2810 /* HeadersH2ButtonsModel.swift in Sources */, 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */, + AAE7270C24AC8B8500A3ED0E /* HeadersH2CaretLinkModel.swift in Sources */, BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */, 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */, D21B7F73243BAC6800051ABF /* CollectionItemModelProtocol.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index fbb2fe8c..38aac342 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -212,6 +212,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2PricingTwoRows.self, viewModelClass: HeadersH2PricingTwoRowsModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Link.self, viewModelClass: HeadersH2LinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2CaretLink.self, viewModelClass: HeadersH2CaretLinkModel.self) // Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift new file mode 100644 index 00000000..1aaf092f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLink.swift @@ -0,0 +1,58 @@ +// +// HeadersH2CaretLink.swift +// MVMCoreUI +// +// Created by Lekshmi S on 01/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class HeadersH2CaretLink: HeaderView { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let headlineBody = HeadlineBody() + public let caretLink = CaretLink() + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [headlineBody, caretLink]) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------- + // MARK: - Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + headlineBody.stylePageHeader() + addMolecule(stack) + stack.restack() + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? HeadersH2CaretLinkModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + caretLink.set(with: model.caretLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headlineBody.stylePageHeader() + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift new file mode 100644 index 00000000..9d56118e --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H2/HeadersH2CaretLinkModel.swift @@ -0,0 +1,66 @@ +// +// HeadersH2CaretLinkModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 01/07/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +public class HeadersH2CaretLinkModel: HeaderModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "headerH2CrtBtn" + public var headlineBody: HeadlineBodyModel + public var caretLink: CaretLinkModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(headlineBody: HeadlineBodyModel, caretLink: CaretLinkModel) { + self.headlineBody = headlineBody + self.caretLink = caretLink + super.init() + } + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + public override func setDefaults() { + if topPadding == nil { + topPadding = Padding.Component.VerticalMarginSpacing + } + if bottomPadding == nil { + bottomPadding = Padding.Component.VerticalMarginSpacing + } + super.setDefaults() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case headlineBody + case caretLink + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(caretLink, forKey: .caretLink) + } +} From 616c242b29fb4786147b5f3546774ae3cef8ef9b Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 11:26:52 -0400 Subject: [PATCH 29/42] remove extra custom protocol --- .../Atomic/Protocols/TemplateProtocol.swift | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift index 699c217c..4696ce38 100644 --- a/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift @@ -11,10 +11,8 @@ import Foundation public protocol TemplateProtocol: AnyObject { associatedtype TemplateModel: TemplateModelProtocol var templateModel: TemplateModel? { get set } -} - -public protocol CustomTemplateDecoder { - func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModelProtocol + + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel } public extension TemplateProtocol where Self: ViewController { @@ -24,14 +22,12 @@ public extension TemplateProtocol where Self: ViewController { let data = try JSONSerialization.data(withJSONObject: pageJSON) let decoder = JSONDecoder() try decoder.add(delegateObject: delegateObjectIVar) - let templateModel: TemplateModel - if let customDecoder = self as? CustomTemplateDecoder { - templateModel = try customDecoder.decodeTemplate(using: decoder, from: data) as! Self.TemplateModel - } else { - templateModel = try decoder.decode(TemplateModel.self, from: data) - } - self.templateModel = templateModel + self.templateModel = try decodeTemplate(using: decoder, from: data) self.pageModel = templateModel as? MVMControllerModelProtocol } + func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> TemplateModel { + return try decoder.decode(TemplateModel.self, from: data) + } + } From 50888916cbad468ccb9223e3dcb4b963f0744c4b Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 14:55:04 -0400 Subject: [PATCH 30/42] open list template model subclassing --- MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift index 4be4e025..372ae778 100644 --- a/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift @@ -28,6 +28,11 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol try super.parsePageJSON() } + // For subclassing the model. + open func decodeTemplate(using decoder: JSONDecoder, from data: Data) throws -> ListPageTemplateModel { + return try decoder.decode(ListPageTemplateModel.self, from: data) + } + open override var loadObject: MVMCoreLoadObject? { didSet { guard loadObject != oldValue else { return } From 012d16ed09893d7722fa123e1cef4ee4210c1c6f Mon Sep 17 00:00:00 2001 From: Kyle Matthew Hedden Date: Wed, 1 Jul 2020 14:55:21 -0400 Subject: [PATCH 31/42] code review --- MVMCoreUI/Atomic/Atoms/Views/Toggle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index bb75d963..dfffcded 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -396,8 +396,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) let alternateActionMap = model.alternateAction?.toJSON() if actionMap != nil || alternateActionMap != nil { didToggleAction = { [weak self] in - guard let strongSelf = self else { return } - if strongSelf.isOn { + guard let self = self else { return } + if self.isOn { if actionMap != nil { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } From 356d8064f294fed13083c74c318a534847328a34 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 2 Jul 2020 15:25:12 -0400 Subject: [PATCH 32/42] allow view to be tappable --- MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m index 3d15652c..ed9f5271 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m @@ -374,6 +374,7 @@ weakSelf.shortViewHeight.active = NO; } completion:^(BOOL finished) { [weakSelf.viewToLayout layoutIfNeeded]; + weakSelf.accessibilityElements = @[weakSelf.shortView.label]; UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil); [MVMCoreDispatchUtility performBlockInBackground:^{ // Must notify animation delegate when animating finished. From 4f013bec6f6f3c7171db6cbfd71c13f378cc0a3d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Jul 2020 16:29:17 -0400 Subject: [PATCH 33/42] action fix for tab bar --- MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift | 3 +++ MVMCoreUI/BaseControllers/ViewController.swift | 1 + MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h | 4 ++-- MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift index 1bf79795..19c7e107 100644 --- a/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift @@ -9,6 +9,9 @@ import Foundation @objc public protocol TabBarProtocol { + + var delegateObject: MVMCoreUIDelegateObject? { get set } + /// Should visually select the given tab index. @objc func highlightTab(at index: Int) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 6a585dab..b6bdc1ca 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -267,6 +267,7 @@ import UIKit open func updateTabBar() { guard MVMCoreUISplitViewController.main()?.getCurrentDetailViewController() == self, let tabModel = pageModel as? TabPageModelProtocol else { return } + MVMCoreUISplitViewController.main()?.tabBar?.delegateObject = delegateObjectIVar if let index = tabModel.tabBarIndex { MVMCoreUISplitViewController.main()?.tabBar?.highlightTab(at: index) } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h index 9fec90f5..14da21ad 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.h @@ -17,8 +17,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)defaultLogPageStateForController:(nonnull id )controller; // Action Logging -- (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; +- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData; @end diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m index 0c694cce..45a13acf 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUILoggingHandler.m @@ -13,10 +13,10 @@ - (void)defaultLogPageStateForController:(nonnull id )controller { } -- (void)defaultLogActionForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { +- (void)defaultLogActionForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { } -- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nonnull id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { +- (nullable NSDictionary *)defaultGetActionTrackDataDictionaryForController:(nullable id )controller actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData { return nil; } From 573d6b2a986c25042fcadfb8957f6180f7cdc487 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 2 Jul 2020 19:20:30 -0400 Subject: [PATCH 34/42] style in model for list item --- .../ListTwoColumnPriceDetailsModel.swift | 5 +- .../ListFourColumnDataUsageDividerModel.swift | 2 +- ...nFullWidthTextDividerSubsectionModel.swift | 2 +- ...nTextWithWhitespaceDividerShortModel.swift | 2 +- ...mnTextWithWhitespaceDividerTallModel.swift | 2 +- ...stThreeColumnBillChangesDividerModel.swift | 2 +- ...ListThreeColumnDataUsageDividerModel.swift | 2 +- ...eColumnInternationalDataDividerModel.swift | 2 +- .../ListThreeColumnPlanDataDividerModel.swift | 2 +- ...ListThreeColumnSpeedTestDividerModel.swift | 2 +- .../ListTwoColumnSubsectionDividerModel.swift | 2 +- .../Items/DropDownListItemModel.swift | 2 +- .../Molecules/Items/ListItemModel.swift | 51 ++++++++++--- .../ListItemModelProtocol.swift | 11 ++- MVMCoreUI/BaseClasses/TableViewCell.swift | 71 ++++++------------- 15 files changed, 85 insertions(+), 75 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift index 86dee27a..97582574 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -33,10 +33,9 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco //-------------------------------------------------- override public func setDefaults() { + style = ListItemStyle.none super.setDefaults() - - style = "none" - + if leftLabel.textColor == nil { leftLabel.textColor = Color(uiColor: .mvmCoolGray6) } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift index 1c161bd4..a094f91c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -33,8 +33,8 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr } override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift index 34687957..063c8cfa 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnFullWidthTextDividerSubsectionModel: ListItemModel, Mo //-------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift index d63ea18b..f6303a85 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnTextWithWhitespaceDividerShortModel: ListItemModel, Mo //-------------------------------------------------- override public func setDefaults() { + style = .shortDivider super.setDefaults() - style = "shortDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift index d8119802..e3bb634d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift @@ -33,8 +33,8 @@ public class ListOneColumnTextWithWhitespaceDividerTallModel: ListItemModel, Mol //-------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift index 6f824fff..965de291 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnBillChangesDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnBillChangesDividerModel: ListItemModel, MoleculeMode //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift index 93efb963..268e68e9 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnDataUsageDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnDataUsageDividerModel: ListItemModel, MoleculeModelP //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift index b4909581..f7df0c3a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnInternationalDataDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnInternationalDataDividerModel: ListItemModel, Molecu //------------------------------------------------------ override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //------------------------------------------------------ diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift index 6b29f58e..84357252 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnPlanDataDividerModel: ListItemModel, MoleculeModelPr //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" leftHeadlineBody.style = .itemHeader centerHeadlineBody.style = .itemHeader rightHeadlineBody.style = .itemHeader diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift index 0e627c2a..fa7ad9f7 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnSpeedTestDividerModel.swift @@ -35,8 +35,8 @@ public class ListThreeColumnSpeedTestDividerModel: ListItemModel, MoleculeModelP //----------------------------------------------------- override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //----------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift index 0cb938ad..407764f2 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnSubsectionDividerModel.swift @@ -33,8 +33,8 @@ public class ListTwoColumnSubsectionDividerModel: ListItemModel, MoleculeModelPr //------------------------------------------------------ override public func setDefaults() { + style = .tallDivider super.setDefaults() - style = "tallDivider" } //------------------------------------------------------ diff --git a/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift index deb2374b..693874e6 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift @@ -24,10 +24,10 @@ import Foundation /// Defaults to set public override func setDefaults() { + style = .sectionFooter super.setDefaults() hideArrow = true line = LineModel(type: .none) - style = "sectionFooter" } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index 81b896f0..fcee1166 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -11,6 +11,7 @@ import Foundation @objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol { + //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -19,7 +20,7 @@ import Foundation public var action: ActionModelProtocol? public var hideArrow: Bool? public var line: LineModel? - public var style: String? + public var style: ListItemStyle? = .standard //-------------------------------------------------- // MARK: - Keys @@ -39,17 +40,39 @@ import Foundation /// Defaults to set open override func setDefaults() { - if useHorizontalMargins == nil { - useHorizontalMargins = true + setByStyle() + } + + /// Convenience function to set common values. + open func set(useHorizontalMargins: Bool? = true, useVerticalMargins: Bool? = true, topPadding: CGFloat? = nil, bottomPadding: CGFloat? = nil) { + if self.useHorizontalMargins == nil { + self.useHorizontalMargins = useHorizontalMargins } - if useVerticalMargins == nil { - useVerticalMargins = true + if self.useVerticalMargins == nil { + self.useVerticalMargins = useVerticalMargins } - if topPadding == nil { - topPadding = 24 + if self.topPadding == nil { + self.topPadding = topPadding } - if bottomPadding == nil { - bottomPadding = 24 + if self.bottomPadding == nil { + self.bottomPadding = bottomPadding + } + } + + /// Convenience function to set common values based on style. + open func setByStyle() { + guard let style = style else { return } + switch style { + case .standard: + set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing) + case .shortDivider: + set(topPadding: Padding.Component.LargeVerticalMarginSpacing, bottomPadding: Padding.Four) + case .tallDivider: + set(topPadding: Padding.Twelve, bottomPadding: Padding.Four) + case .sectionFooter: + set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: 0) + case ListItemStyle.none: + set(topPadding: 0, bottomPadding: 0) } } @@ -57,6 +80,12 @@ import Foundation // MARK: - Initializer //-------------------------------------------------- + public init(style: ListItemStyle? = .standard, action: ActionModelProtocol?) { + self.style = style + self.action = action + super.init() + } + public override init(horizontalAlignment: UIStackView.Alignment? = nil, verticalAlignment: UIStackView.Alignment? = nil, useHorizontalMargins: Bool? = nil, leftPadding: CGFloat? = nil, rightPadding: CGFloat? = nil, useVerticalMargins: Bool? = nil, topPadding: CGFloat? = nil, bottomPadding: CGFloat? = nil) { super.init(horizontalAlignment: horizontalAlignment, verticalAlignment: verticalAlignment, useHorizontalMargins: useHorizontalMargins, leftPadding: leftPadding, rightPadding: rightPadding, useVerticalMargins: useVerticalMargins, topPadding: topPadding, bottomPadding: bottomPadding) } @@ -75,7 +104,9 @@ import Foundation action = try typeContainer.decodeModelIfPresent(codingKey: .action) hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) - style = try typeContainer.decodeIfPresent(String.self, forKey: .style) + if let style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) { + self.style = style + } try super.init(from: decoder) } diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift index 5d0fee08..b13ff039 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/ListItemModelProtocol.swift @@ -8,12 +8,19 @@ import Foundation +public enum ListItemStyle: String, Codable { + case standard + case shortDivider + case tallDivider + case sectionFooter + case none +} public protocol ListItemModelProtocol: ContainerModelProtocol { var line: LineModel? { get set } var action: ActionModelProtocol? { get set } var hideArrow: Bool? { get set } - var style: String? { get set } + var style: ListItemStyle? { get set } } // Not a strict requirement. @@ -24,7 +31,7 @@ public extension ListItemModelProtocol { set { } } - var style: String? { + var style: ListItemStyle? { get { return nil } set { } } diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index 300150e8..bb5871d0 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -31,60 +31,33 @@ import UIKit private var initialSetupPerformed = false // MARK: - Styling - open func style(with styleString: String?) { - guard let styleString = styleString else { - return - } - switch styleString { - case "standard": - styleStandard() - case "shortDivider": - styleShortDivider() - case "tallDivider": - styleTallDivider() - case "sectionFooter": - styleFooter() - case "none": - styleNone() + open func styleLine(with style: ListItemStyle?) { + switch style { + case .standard?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.standard) + case .shortDivider?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.thin) + case .tallDivider?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.thin) + case .sectionFooter?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.none) + case ListItemStyle.none?: + topSeparatorView?.setStyle(.none) + bottomSeparatorView?.setStyle(.none) default: break } } + /// Default state. open func styleStandard() { - listItemModel?.topPadding = 24 - listItemModel?.bottomPadding = 24 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.standard) + MFStyler.setMarginsFor(self, size: MVMCoreUIUtility.getWidth(), defaultHorizontal: true, top: Padding.Component.VerticalMarginSpacing, bottom: Padding.Component.VerticalMarginSpacing) + styleLine(with: .standard) } - - open func styleTallDivider() { - listItemModel?.topPadding = 48 - listItemModel?.bottomPadding = 16 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) - } - - open func styleShortDivider() { - listItemModel?.topPadding = 32 - listItemModel?.bottomPadding = 16 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.thin) - } - - open func styleFooter() { - listItemModel?.topPadding = 24 - listItemModel?.bottomPadding = 0 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.none) - } - - open func styleNone() { - listItemModel?.topPadding = 0 - listItemModel?.bottomPadding = 0 - topSeparatorView?.setStyle(.none) - bottomSeparatorView?.setStyle(.none) - } - + /// Adds the molecule to the view. open func addMolecule(_ molecule: MoleculeViewProtocol) { contentView.addSubview(molecule) @@ -156,7 +129,7 @@ import UIKit guard let model = model as? ListItemModelProtocol else { return } self.listItemModel = model - style(with: model.style) + styleLine(with: model.style) // Add the caret if there is an action and it's not declared hidden. if !customAccessoryView { From 63c793fe25331b9a865e98fa537f7405d2aa2dfc Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 6 Jul 2020 15:33:25 -0400 Subject: [PATCH 35/42] accessibility fix --- .../TextFields/DigitEntryField.swift | 5 +-- .../Atomic/Atoms/Selectors/RadioBox.swift | 39 +++++++++++++++++-- .../RadioBoxCollectionViewCell.swift | 8 ++++ .../Atomic/Atoms/Selectors/RadioBoxes.swift | 10 +++++ .../Atomic/Atoms/Selectors/RadioSwatch.swift | 27 ++++++++++++- .../RadioSwatchCollectionViewCell.swift | 20 ++++++++++ .../Atoms/Selectors/RadioSwatches.swift | 10 +++++ .../CarouselIndicator/BarsIndicatorView.swift | 5 +-- .../CarouselIndicator/CarouselIndicator.swift | 5 +-- .../Strings/en.lproj/Localizable.strings | 2 +- .../Strings/es-MX.lproj/Localizable.strings | 1 + MVMCoreUI/Utility/MVMCoreUIUtility.h | 3 ++ MVMCoreUI/Utility/MVMCoreUIUtility.m | 6 +++ 13 files changed, 124 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift index 18f61b2d..b1f202a8 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DigitEntryField.swift @@ -25,12 +25,9 @@ import UIKit if numberOfDigits > 0 { var digitBoxes = [DigitBox]() - let ordinalFormatter = NumberFormatter() - ordinalFormatter.numberStyle = .ordinal - for i in 0.. Date: Mon, 6 Jul 2020 15:56:12 -0400 Subject: [PATCH 36/42] revised name --- MVMCoreUI/Categories/UIColor+Extension.swift | 78 ++++++++++---------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index e04a7d46..580a6ed6 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -71,149 +71,153 @@ extension UIColor { //-------------------------------------------------- /// HEX: #D52B1E - public static let mvmRed = UIColor(named: "red")! + public static let mvmRed = UIColor.assetColor(named: "red") //-------------------------------------------------- // MARK: - Pink //-------------------------------------------------- /// HEX: #D90368 - public static let mvmPink = UIColor(named: "pink")! + public static let mvmPink = UIColor.assetColor(named: "pink") /// HEX: #F2ABCD - public static let mvmPink33 = UIColor(named: "pink33")! + public static let mvmPink33 = UIColor.assetColor(named: "pink33") /// HEX: #E6589B - public static let mvmPink66 = UIColor(named: "pink66")! + public static let mvmPink66 = UIColor.assetColor(named: "pink66") /// HEX: #B31C63 - public static let mvmPinkShade1 = UIColor(named: "pinkShade1")! + public static let mvmPinkShade1 = UIColor.assetColor(named: "pinkShade1") /// HEX: #830842 - public static let mvmPinkShade2 = UIColor(named: "pinkShade2")! + public static let mvmPinkShade2 = UIColor.assetColor(named: "pinkShade2") //-------------------------------------------------- // MARK: - Purple //-------------------------------------------------- /// HEX: #8C00AC - public static let mvmPurple = UIColor(named: "purple")! + public static let mvmPurple = UIColor.assetColor(named: "purple") /// HEX: #D9ABE4 - public static let mvmPurple33 = UIColor(named: "purple33")! + public static let mvmPurple33 = UIColor.assetColor(named: "purple33") /// HEX: #B356C8 - public static let mvmPurple66 = UIColor(named: "purple66")! + public static let mvmPurple66 = UIColor.assetColor(named: "purple66") /// HEX: #6C177F - public static let mvmPurpleShade1 = UIColor(named: "purpleShade1")! + public static let mvmPurpleShade1 = UIColor.assetColor(named: "purpleShade1") /// HEX: #4A0E58 - public static let mvmPurpleShade2 = UIColor(named: "purpleShade2")! + public static let mvmPurpleShade2 = UIColor.assetColor(named: "purpleShade2") //-------------------------------------------------- // MARK: - Orange //-------------------------------------------------- /// HEX: #ED7000 - public static let mvmOrange = UIColor(named: "orange")! + public static let mvmOrange = UIColor.assetColor(named: "orange") /// HEX: #CC4D0F - public static let mvmOrangeAA = UIColor(named: "orangeAA")! + public static let mvmOrangeAA = UIColor.assetColor(named: "orangeAA") /// HEX: #F9D0AB - public static let mvmOrange33 = UIColor(named: "orange33")! + public static let mvmOrange33 = UIColor.assetColor(named: "orange33") /// HEX: #F3A157 - public static let mvmOrange66 = UIColor(named: "orange66")! + public static let mvmOrange66 = UIColor.assetColor(named: "orange66") /// HEX: #CB5F00 - public static let mvmOrangeShade1 = UIColor(named: "orangeShade1")! + public static let mvmOrangeShade1 = UIColor.assetColor(named: "orangeShade1") /// HEX: #984700 - public static let mvmOrangeShade2 = UIColor(named: "orangeShade2")! + public static let mvmOrangeShade2 = UIColor.assetColor(named: "orangeShade2") //-------------------------------------------------- // MARK: - Green //-------------------------------------------------- /// HEX: #008330 - public static let mvmGreen = UIColor(named: "green")! + public static let mvmGreen = UIColor.assetColor(named: "green") /// HEX: #ABE4BF - public static let mvmGreen33 = UIColor(named: "green33")! + public static let mvmGreen33 = UIColor.assetColor(named: "green33") /// HEX: #57C880 - public static let mvmGreen66 = UIColor(named: "green66")! + public static let mvmGreen66 = UIColor.assetColor(named: "green66") /// HEX: #0F5B25 - public static let mvmGreenShade2 = UIColor(named: "greenShade2")! + public static let mvmGreenShade2 = UIColor.assetColor(named: "greenShade2") /// HEX: #00AC3E - public static let mvmGreenInverted = UIColor(named: "greenInverted")! + public static let mvmGreenInverted = UIColor.assetColor(named: "greenInverted") //-------------------------------------------------- // MARK: - Blue //-------------------------------------------------- /// HEX: #0077B4 - public static let mvmBlue = UIColor(named: "blue")! + public static let mvmBlue = UIColor.assetColor(named: "blue") /// HEX: #ABD8EF - public static let mvmBlue33 = UIColor(named: "blue33")! + public static let mvmBlue33 = UIColor.assetColor(named: "blue33") /// HEX: #57B1DF - public static let mvmBlue66 = UIColor(named: "blue66")! + public static let mvmBlue66 = UIColor.assetColor(named: "blue66") /// HEX: #136598 - public static let mvmBlueShade1 = UIColor(named: "blueShade1")! + public static let mvmBlueShade1 = UIColor.assetColor(named: "blueShade1") /// HEX: #0B4467 - public static let mvmBlueShade2 = UIColor(named: "blueShade2")! + public static let mvmBlueShade2 = UIColor.assetColor(named: "blueShade2") /// HEX: #0088CE - public static let mvmBlueInverted = UIColor(named: "blueInverted")! + public static let mvmBlueInverted = UIColor.assetColor(named: "blueInverted") //-------------------------------------------------- // MARK: - Yellow //-------------------------------------------------- /// HEX: #FFBC3D - public static let mvmYellow = UIColor(named: "yellow")! + public static let mvmYellow = UIColor.assetColor(named: "yellow") //-------------------------------------------------- // MARK: - Gray //-------------------------------------------------- /// HEX: #F6F6F6 - public static let mvmCoolGray1 = UIColor(named: "coolGray1")! + public static let mvmCoolGray1 = UIColor.assetColor(named: "coolGray1") /// HEX: #D8DADA - public static let mvmCoolGray3 = UIColor(named: "coolGray3")! + public static let mvmCoolGray3 = UIColor.assetColor(named: "coolGray3") /// HEX: #747676 - public static let mvmCoolGray6 = UIColor(named: "coolGray6")! + public static let mvmCoolGray6 = UIColor.assetColor(named: "coolGray6") /// HEX: #333333 - public static let mvmCoolGray10 = UIColor(named: "coolGray10")! + public static let mvmCoolGray10 = UIColor.assetColor(named: "coolGray10") //-------------------------------------------------- // MARK: - VZ UP Brand //-------------------------------------------------- /// HEX: #F9D542 - public static let vzupGold1 = UIColor(named: "upGold1")! + public static let vzupGold1 = UIColor.assetColor(named: "upGold1") /// HEX: #F4CA53 - public static let vzupGold2 = UIColor(named: "upGold2")! + public static let vzupGold2 = UIColor.assetColor(named: "upGold2") /// HEX: #CC9B2D - public static let vzupGold3 = UIColor(named: "upGold3")! + public static let vzupGold3 = UIColor.assetColor(named: "upGold3") //-------------------------------------------------- // MARK: - Functions //-------------------------------------------------- + public static func assetColor(named name: String) -> UIColor { + return UIColor(named: name, in: MVMCoreUIUtility.bundleForMVMCoreUI(), compatibleWith: nil)! + } + /// Convenience to get a grayscale UIColor where the same value is used for red, green, and blue. public class func grayscale(rgb: Int, alpha: CGFloat = 1.0) -> UIColor { @@ -299,7 +303,7 @@ extension UIColor { } else if numberOfComponents == 2 { // Monochromatic color space let value = Int(CGFloat(components[0]) * 255) - + // If alpha of color is less than 1.0 then alpha hex is relevant. if components[1] < 1.0 { let alpha = Int(CGFloat(components[1]) * 255) From a09927aba9386a4fc5fc727d4dfe8d6d32c47f97 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jul 2020 11:07:44 -0400 Subject: [PATCH 37/42] remvoe as it is already 0 when arriving --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index ae9cce75..044df666 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -167,7 +167,6 @@ open class LoadingSpinner: View { isHidden = false layer.speed = speed layer.timeOffset = 0 - layer.beginTime = 0 let timeSincePause = layer.convertTime(CACurrentMediaTime(), from: nil) - pausedTime layer.beginTime = timeSincePause } @@ -197,6 +196,7 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth pinWidthAndHeight(diameter: model.diameter) + resumeSpinnerAfterDelay() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From a3ddadf14cd8464f65c521ea66b69f1fa7e0461a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jul 2020 11:24:04 -0400 Subject: [PATCH 38/42] comment --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 044df666..7672329c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -87,7 +87,7 @@ open class LoadingSpinner: View { let length: CGFloat } - // TODO: This needs more attention + // TODO: This needs more attention to improve frame smoothness. class var poses: [Pose] { get { return [ From a386a19e247094a34635c949f2a99f6e985c9507 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 7 Jul 2020 13:34:04 -0400 Subject: [PATCH 39/42] missed commit? --- MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings | 1 + 1 file changed, 1 insertion(+) diff --git a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings index 8e0dbd02..47d124a9 100644 --- a/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/es.lproj/Localizable.strings @@ -9,6 +9,7 @@ // Accessibility "swipe_to_select_with_action_hint" = "deslízate hacia arriba o hacia abajo para seleccionar la acción, luego toca dos veces para seleccionar."; "AccDisabled" = "desactivado"; +"index_string_of_total" = "%@ de %d"; "AccCloseButton" = "Cerrar"; // Tab From 53764d363ab3ca2c9a8f00378fcaa64e1a5d76ef Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jul 2020 14:30:11 -0400 Subject: [PATCH 40/42] removed for testing --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 7672329c..60abec3c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -196,7 +196,6 @@ open class LoadingSpinner: View { strokeColor = model.strokeColor.uiColor lineWidth = model.lineWidth pinWidthAndHeight(diameter: model.diameter) - resumeSpinnerAfterDelay() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { From 027b9c9930a18482bdf9ac7a3a1a0025e72ebfaf Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jul 2020 14:52:30 -0400 Subject: [PATCH 41/42] reuse and rotate --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 60abec3c..9bb6ff91 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -48,6 +48,7 @@ open class LoadingSpinner: View { override open func layoutSubviews() { super.layoutSubviews() +// layer.fillColor = nil layer.strokeColor = strokeColor.cgColor layer.lineWidth = lineWidth @@ -63,9 +64,17 @@ open class LoadingSpinner: View { clockwise: true).cgPath } + open override func updateView(_ size: CGFloat) { + super.updateView(size) + + layer.removeAllAnimations() + animate() + } + public override func reset() { super.reset() + layer.removeAllAnimations() heightConstraint?.isActive = false widthConstraint?.isActive = false } From 75c26b21f5074af4524cdf32e641476f05d50d9e Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 7 Jul 2020 14:55:29 -0400 Subject: [PATCH 42/42] emwovw --- MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift index 9bb6ff91..2d58c8f4 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LoadingSpinner.swift @@ -48,7 +48,7 @@ open class LoadingSpinner: View { override open func layoutSubviews() { super.layoutSubviews() -// + layer.fillColor = nil layer.strokeColor = strokeColor.cgColor layer.lineWidth = lineWidth