From d0b390291580ad43d701b00e37c19e4d70bba372 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 4 Aug 2020 17:27:17 +0530 Subject: [PATCH 1/6] 22008(iOS - List - Three Column - Speed Test) initial commit. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 + MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../ListThreeColumnSpeedTest.swift | 139 ++++++++++++++++++ .../ListThreeColumnSpeedTestModel.swift | 79 ++++++++++ 4 files changed, 227 insertions(+) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 97f48227..454ef7e7 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -242,6 +242,8 @@ AAB7EDF1246ADA2A00E54929 /* ListProgressBarThin.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB7EDF0246ADA2A00E54929 /* ListProgressBarThin.swift */; }; AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; }; AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; }; + AAC23FAD24D92A0D009208DF /* ListThreeColumnSpeedTestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC23FAC24D92A0D009208DF /* ListThreeColumnSpeedTestModel.swift */; }; + AAC23FAF24D92A1E009208DF /* ListThreeColumnSpeedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC23FAE24D92A1E009208DF /* ListThreeColumnSpeedTest.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 */; }; @@ -719,6 +721,8 @@ AAB7EDF0246ADA2A00E54929 /* ListProgressBarThin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListProgressBarThin.swift; sourceTree = ""; }; AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = ""; }; AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = ""; }; + AAC23FAC24D92A0D009208DF /* ListThreeColumnSpeedTestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnSpeedTestModel.swift; sourceTree = ""; }; + AAC23FAE24D92A1E009208DF /* ListThreeColumnSpeedTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnSpeedTest.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 = ""; }; @@ -1160,6 +1164,8 @@ 323AC96B24C837FF00F8E4C4 /* ListThreeColumnBillChanges.swift */, AAA905DE24D1758700D1EFAB /* ListThreeColumnBillHistoryModel.swift */, AAA905E024D1759A00D1EFAB /* ListThreeColumnBillHistory.swift */, + AAC23FAC24D92A0D009208DF /* ListThreeColumnSpeedTestModel.swift */, + AAC23FAE24D92A1E009208DF /* ListThreeColumnSpeedTest.swift */, ); path = ThreeColumn; sourceTree = ""; @@ -2189,6 +2195,7 @@ 94C2D9A923872E5E0006CF46 /* LabelAttributeImageModel.swift in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */, D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */, + AAC23FAD24D92A0D009208DF /* ListThreeColumnSpeedTestModel.swift in Sources */, BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, 3265B30424BCA749000D154B /* HeadersH1NoButtonsBodyText.swift in Sources */, @@ -2288,6 +2295,7 @@ 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */, 94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, + AAC23FAF24D92A1E009208DF /* ListThreeColumnSpeedTest.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index ef8e4573..27123d63 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -194,6 +194,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnBillChanges.self, viewModelClass: ListThreeColumnBillChangesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnBillHistory.self, viewModelClass: ListThreeColumnBillHistoryModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnSpeedTest.self, viewModelClass: ListThreeColumnSpeedTestModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarThin.self, viewModelClass: ListProgressBarThinModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift new file mode 100644 index 00000000..9c1b342f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -0,0 +1,139 @@ +// +// ListThreeColumnSpeedTest.swift +// MVMCoreUI +// +// Created by Lekshmi S on 04/08/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListThreeColumnSpeedTest: TableViewCell { + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + public var title = Label(fontStyle: .RegularMicro) + public var topLeftHeadlineBody = HeadlineBody() + public var bottomLeftHeadlineBody = HeadlineBody() + public var verticalStack1: Stack + public var topCenterHeadlineBody = HeadlineBody() + public var bottomCenterHeadlineBody = HeadlineBody() + public var verticalStack2: Stack + public var topRightHeadlineBody = HeadlineBody() + public var bottomRightHeadlineBody = HeadlineBody() + public var verticalStack3: Stack + public var horizontalStack: Stack + public var stack: Stack + + //------------------------------------------------------ + // MARK: - Initializers + //------------------------------------------------------ + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + + verticalStack1 = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) + verticalStack2 = Stack.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) + verticalStack3 = Stack.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) + horizontalStack = Stack.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 36, horizontalAlignment: .leading)), + (view: verticalStack2, model: StackItemModel(percent: 34, horizontalAlignment: .leading)), + (view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))], + axis: .horizontal) + stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //------------------------------------------------------ + // MARK: - Lifecycle + //------------------------------------------------------ + open override func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + verticalStack1.restack() + verticalStack2.restack() + verticalStack3.restack() + horizontalStack.restack() + } + + //-------------------------------------------------- + // MARK: - ModelMoleculeViewProtocol + //-------------------------------------------------- + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListThreeColumnSpeedTestModel else { return } + title.set(with: model.title, delegateObject, additionalData) + verticalStack1.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.bottomLeftHeadlineBody], delegateObject, additionalData) + verticalStack2.updateContainedMolecules(with: [model.topCenterHeadlineBody, model.bottomCenterHeadlineBody], delegateObject, additionalData) + verticalStack3.updateContainedMolecules(with: [model.topRightHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) + updateAccessibilityLabel() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } + + open override func reset() { + super.reset() + title.setFontStyle(.BoldBodySmall) + styleHeadlineBody(topLeftHeadlineBody, true) + styleHeadlineBody(bottomLeftHeadlineBody, false) + styleHeadlineBody(topCenterHeadlineBody, false) + styleHeadlineBody(bottomCenterHeadlineBody, false) + styleHeadlineBody(topRightHeadlineBody, false) + styleHeadlineBody(bottomRightHeadlineBody, false) + } + + func styleHeadlineBody(_ headlineBody: HeadlineBody, _ isBodyMicro: Bool) { + headlineBody.headlineLabel.setFontStyle(.RegularMicro) + headlineBody.headlineLabel.textColor = .mvmCoolGray6 + headlineBody.messageLabel.setFontStyle(.RegularBodySmall) + if isBodyMicro { + headlineBody.messageLabel.setFontStyle(.RegularMicro) + headlineBody.messageLabel.textColor = .mvmCoolGray6 + } + } + + //-------------------------------------------------- + // MARK: - Accessibility + //-------------------------------------------------- + func updateAccessibilityLabel() { + isAccessibilityElement = true + var message = "" + if let title = title.text, !title.isEmpty { + message += title + ", " + } + if let topLeftHeadlineBodyText = accessibilityTextOfHeadlineBody(topLeftHeadlineBody), !topLeftHeadlineBodyText.isEmpty { + message += topLeftHeadlineBodyText + ", " + } + if let topCenterHeadlineBodyText = accessibilityTextOfHeadlineBody(topCenterHeadlineBody), !topCenterHeadlineBodyText.isEmpty { + message += topCenterHeadlineBodyText + ", " + } + if let topRightHeadlineBodyText = accessibilityTextOfHeadlineBody(topRightHeadlineBody), !topRightHeadlineBodyText.isEmpty { + message += topRightHeadlineBodyText + ", " + } + if let bottomLeftHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomLeftHeadlineBody), !bottomLeftHeadlineBodyText.isEmpty { + message += bottomLeftHeadlineBodyText + ", " + } + if let bottomCenterHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomCenterHeadlineBody), !bottomCenterHeadlineBodyText.isEmpty { + message += bottomCenterHeadlineBodyText + ", " + } + if let bottomRightHeadlineBodyText = accessibilityTextOfHeadlineBody(bottomRightHeadlineBody), !bottomRightHeadlineBodyText.isEmpty { + message += bottomRightHeadlineBodyText + } + accessibilityLabel = message + } + + func accessibilityTextOfHeadlineBody(_ headlineBody: HeadlineBody) -> String? { + var message = "" + if let headlineLabel = headlineBody.headlineLabel.text { + message += headlineLabel + ", " + } + if let messageLabel = headlineBody.messageLabel.text { + message += messageLabel + } + return message + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift new file mode 100644 index 00000000..1ba62c2f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift @@ -0,0 +1,79 @@ +// +// ListThreeColumnSpeedTestModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 04/08/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "list3CSpdTst" + public var title: LabelModel + public var topLeftHeadlineBody: HeadlineBodyModel + public var topCenterHeadlineBody: HeadlineBodyModel + public var topRightHeadlineBody: HeadlineBodyModel + public var bottomLeftHeadlineBody: HeadlineBodyModel + public var bottomCenterHeadlineBody: HeadlineBodyModel + public var bottomRightHeadlineBody: HeadlineBodyModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(title: LabelModel, topLeftHeadlineBody: HeadlineBodyModel, topCenterHeadlineBody: HeadlineBodyModel, topRightHeadlineBody: HeadlineBodyModel, bottomLeftHeadlineBody: HeadlineBodyModel, bottomCenterHeadlineBody: HeadlineBodyModel, bottomRightHeadlineBody: HeadlineBodyModel) { + self.title = title + self.topLeftHeadlineBody = topLeftHeadlineBody + self.topCenterHeadlineBody = topCenterHeadlineBody + self.topRightHeadlineBody = topRightHeadlineBody + self.bottomLeftHeadlineBody = bottomLeftHeadlineBody + self.bottomCenterHeadlineBody = bottomCenterHeadlineBody + self.bottomRightHeadlineBody = bottomRightHeadlineBody + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case title + case topLeftHeadlineBody + case topCenterHeadlineBody + case topRightHeadlineBody + case bottomLeftHeadlineBody + case bottomCenterHeadlineBody + case bottomRightHeadlineBody + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + title = try typeContainer.decode(LabelModel.self, forKey: .title) + topLeftHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .topLeftHeadlineBody) + topCenterHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .topCenterHeadlineBody) + topRightHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .topRightHeadlineBody) + bottomLeftHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .bottomLeftHeadlineBody) + bottomCenterHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .bottomCenterHeadlineBody) + bottomRightHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .bottomRightHeadlineBody) + 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(title, forKey: .title) + try container.encode(topLeftHeadlineBody, forKey: .topLeftHeadlineBody) + try container.encode(topCenterHeadlineBody, forKey: .topCenterHeadlineBody) + try container.encode(topRightHeadlineBody, forKey: .topRightHeadlineBody) + try container.encode(bottomLeftHeadlineBody, forKey: .bottomLeftHeadlineBody) + try container.encode(bottomCenterHeadlineBody, forKey: .bottomCenterHeadlineBody) + try container.encode(bottomRightHeadlineBody, forKey: .bottomRightHeadlineBody) + } +} From 61f6f388218fa39115c1feb437f331661d78e839 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 4 Aug 2020 17:56:33 +0530 Subject: [PATCH 2/6] Adjusted percent values. --- .../List/ThreeColumn/ListThreeColumnSpeedTest.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift index 9c1b342f..1290a3d3 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -34,8 +34,8 @@ import Foundation verticalStack2 = Stack.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) verticalStack3 = Stack.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) horizontalStack = Stack.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 36, horizontalAlignment: .leading)), - (view: verticalStack2, model: StackItemModel(percent: 34, horizontalAlignment: .leading)), - (view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))], + (view: verticalStack2, model: StackItemModel(percent: 32, horizontalAlignment: .leading)), + (view: verticalStack3, model: StackItemModel(percent: 32, horizontalAlignment: .trailing))], axis: .horizontal) stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0) super.init(style: style, reuseIdentifier: reuseIdentifier) From 8f12770e00cc98d6feb03238b27be26b31b8cf13 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 5 Aug 2020 17:20:53 +0530 Subject: [PATCH 3/6] Code changes after internal review. --- .../List/ThreeColumn/ListThreeColumnSpeedTest.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift index 1290a3d3..bf7cb43d 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -33,11 +33,11 @@ import Foundation verticalStack1 = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) verticalStack2 = Stack.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) verticalStack3 = Stack.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) - horizontalStack = Stack.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 36, horizontalAlignment: .leading)), - (view: verticalStack2, model: StackItemModel(percent: 32, horizontalAlignment: .leading)), - (view: verticalStack3, model: StackItemModel(percent: 32, horizontalAlignment: .trailing))], + horizontalStack = Stack.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 37, horizontalAlignment: .leading)), + (view: verticalStack2, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), + (view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))], axis: .horizontal) - stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0) + stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 2) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -50,6 +50,7 @@ import Foundation //------------------------------------------------------ open override func setupView() { super.setupView() + title.numberOfLines = 1 addMolecule(stack) stack.restack() verticalStack1.restack() @@ -86,6 +87,7 @@ import Foundation styleHeadlineBody(bottomRightHeadlineBody, false) } + //Method to style headline label and message label of HeadlineBody func styleHeadlineBody(_ headlineBody: HeadlineBody, _ isBodyMicro: Bool) { headlineBody.headlineLabel.setFontStyle(.RegularMicro) headlineBody.headlineLabel.textColor = .mvmCoolGray6 @@ -94,6 +96,7 @@ import Foundation headlineBody.messageLabel.setFontStyle(.RegularMicro) headlineBody.messageLabel.textColor = .mvmCoolGray6 } + headlineBody.spaceBetweenLabelsConstant = 2 } //-------------------------------------------------- From 0256ede110a8fdeebe1042b3e316147c7fe765f6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 10 Aug 2020 14:45:54 -0400 Subject: [PATCH 4/6] update --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 27123d63..f5b91c52 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -127,7 +127,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: LockupsPlanSMLXL.self, viewModelClass: LockupsPlanSMLXLModel.self) // MARK:- List items MoleculeObjectMapping.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) From 25ce6b285ff9074bf700c9c7d26c7b0df002c3e8 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 11 Aug 2020 18:02:41 +0530 Subject: [PATCH 5/6] Code changes as per review comment. --- .../ListThreeColumnSpeedTest.swift | 57 ++++++------------- .../ListThreeColumnSpeedTestModel.swift | 24 ++++++++ 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift index bf7cb43d..f3070959 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -14,30 +14,22 @@ import Foundation //------------------------------------------------------- public var title = Label(fontStyle: .RegularMicro) public var topLeftHeadlineBody = HeadlineBody() - public var bottomLeftHeadlineBody = HeadlineBody() - public var verticalStack1: Stack public var topCenterHeadlineBody = HeadlineBody() - public var bottomCenterHeadlineBody = HeadlineBody() - public var verticalStack2: Stack public var topRightHeadlineBody = HeadlineBody() + public var tophorizontalStack: Stack + public var bottomLeftHeadlineBody = HeadlineBody() + public var bottomCenterHeadlineBody = HeadlineBody() public var bottomRightHeadlineBody = HeadlineBody() - public var verticalStack3: Stack - public var horizontalStack: Stack + public var bottomhorizontalStack: Stack public var stack: Stack //------------------------------------------------------ // MARK: - Initializers //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - - verticalStack1 = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) - verticalStack2 = Stack.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) - verticalStack3 = Stack.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) - horizontalStack = Stack.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 37, horizontalAlignment: .leading)), - (view: verticalStack2, model: StackItemModel(percent: 33, horizontalAlignment: .leading)), - (view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))], - axis: .horizontal) - stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 2) + tophorizontalStack = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) + bottomhorizontalStack = Stack.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) + stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: tophorizontalStack, model: StackItemModel(spacing: 2, horizontalAlignment: .leading)), (view: bottomhorizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -53,10 +45,8 @@ import Foundation title.numberOfLines = 1 addMolecule(stack) stack.restack() - verticalStack1.restack() - verticalStack2.restack() - verticalStack3.restack() - horizontalStack.restack() + tophorizontalStack.restack() + bottomhorizontalStack.restack() } //-------------------------------------------------- @@ -66,9 +56,8 @@ import Foundation super.set(with: model, delegateObject, additionalData) guard let model = model as? ListThreeColumnSpeedTestModel else { return } title.set(with: model.title, delegateObject, additionalData) - verticalStack1.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.bottomLeftHeadlineBody], delegateObject, additionalData) - verticalStack2.updateContainedMolecules(with: [model.topCenterHeadlineBody, model.bottomCenterHeadlineBody], delegateObject, additionalData) - verticalStack3.updateContainedMolecules(with: [model.topRightHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) + tophorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData) + bottomhorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) updateAccessibilityLabel() } @@ -79,24 +68,12 @@ import Foundation open override func reset() { super.reset() title.setFontStyle(.BoldBodySmall) - styleHeadlineBody(topLeftHeadlineBody, true) - styleHeadlineBody(bottomLeftHeadlineBody, false) - styleHeadlineBody(topCenterHeadlineBody, false) - styleHeadlineBody(bottomCenterHeadlineBody, false) - styleHeadlineBody(topRightHeadlineBody, false) - styleHeadlineBody(bottomRightHeadlineBody, false) - } - - //Method to style headline label and message label of HeadlineBody - func styleHeadlineBody(_ headlineBody: HeadlineBody, _ isBodyMicro: Bool) { - headlineBody.headlineLabel.setFontStyle(.RegularMicro) - headlineBody.headlineLabel.textColor = .mvmCoolGray6 - headlineBody.messageLabel.setFontStyle(.RegularBodySmall) - if isBodyMicro { - headlineBody.messageLabel.setFontStyle(.RegularMicro) - headlineBody.messageLabel.textColor = .mvmCoolGray6 - } - headlineBody.spaceBetweenLabelsConstant = 2 + topLeftHeadlineBody.spaceBetweenLabelsConstant = 2 + topCenterHeadlineBody.spaceBetweenLabelsConstant = 2 + topRightHeadlineBody.spaceBetweenLabelsConstant = 2 + bottomLeftHeadlineBody.spaceBetweenLabelsConstant = 2 + bottomCenterHeadlineBody.spaceBetweenLabelsConstant = 2 + bottomRightHeadlineBody.spaceBetweenLabelsConstant = 2 } //-------------------------------------------------- diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift index 1ba62c2f..24f8c160 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift @@ -35,6 +35,30 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol super.init() } + //------------------------------------------------------ + // MARK: - Method + //------------------------------------------------------ + override public func setDefaults() { + styleHeadlineBody(topLeftHeadlineBody, true) + styleHeadlineBody(bottomLeftHeadlineBody, false) + styleHeadlineBody(topCenterHeadlineBody, false) + styleHeadlineBody(bottomCenterHeadlineBody, false) + styleHeadlineBody(topRightHeadlineBody, false) + styleHeadlineBody(bottomRightHeadlineBody, false) + super.setDefaults() + } + + //Method to style headline and body of HeadlineBody + func styleHeadlineBody(_ headlineBodyModel: HeadlineBodyModel, _ isBodyMicro: Bool) { + headlineBodyModel.headline?.fontStyle = .RegularMicro + headlineBodyModel.headline?.textColor = Color(uiColor: .mvmCoolGray6) + headlineBodyModel.body?.fontStyle = .RegularBodySmall + if isBodyMicro { + headlineBodyModel.body?.fontStyle = .RegularMicro + headlineBodyModel.body?.textColor = Color(uiColor: .mvmCoolGray6) + } + } + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- From 83d15aeba4f91ca734c744313c79d2f84110eb55 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Thu, 13 Aug 2020 09:33:20 -0400 Subject: [PATCH 6/6] small corrections --- .../ListThreeColumnSpeedTest.swift | 19 +++++++++---------- .../ListThreeColumnSpeedTestModel.swift | 3 ++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift index f3070959..28feb481 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTest.swift @@ -16,20 +16,20 @@ import Foundation public var topLeftHeadlineBody = HeadlineBody() public var topCenterHeadlineBody = HeadlineBody() public var topRightHeadlineBody = HeadlineBody() - public var tophorizontalStack: Stack + public var topHorizontalStack: Stack public var bottomLeftHeadlineBody = HeadlineBody() public var bottomCenterHeadlineBody = HeadlineBody() public var bottomRightHeadlineBody = HeadlineBody() - public var bottomhorizontalStack: Stack + public var bottomHorizontalStack: Stack public var stack: Stack //------------------------------------------------------ // MARK: - Initializers //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - tophorizontalStack = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) - bottomhorizontalStack = Stack.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) - stack = Stack.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: tophorizontalStack, model: StackItemModel(spacing: 2, horizontalAlignment: .leading)), (view: bottomhorizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical) + topHorizontalStack = Stack.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) + bottomHorizontalStack = Stack.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal) + stack = Stack.createStack(with: [(view: title, model: StackItemModel()), (view: topHorizontalStack, model: StackItemModel(spacing: 2)), (view: bottomHorizontalStack, model: StackItemModel())], axis: .vertical) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -42,11 +42,10 @@ import Foundation //------------------------------------------------------ open override func setupView() { super.setupView() - title.numberOfLines = 1 addMolecule(stack) stack.restack() - tophorizontalStack.restack() - bottomhorizontalStack.restack() + topHorizontalStack.restack() + bottomHorizontalStack.restack() } //-------------------------------------------------- @@ -56,8 +55,8 @@ import Foundation super.set(with: model, delegateObject, additionalData) guard let model = model as? ListThreeColumnSpeedTestModel else { return } title.set(with: model.title, delegateObject, additionalData) - tophorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData) - bottomhorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) + topHorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData) + bottomHorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData) updateAccessibilityLabel() } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift index 24f8c160..45a9af13 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/ThreeColumn/ListThreeColumnSpeedTestModel.swift @@ -52,10 +52,11 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol func styleHeadlineBody(_ headlineBodyModel: HeadlineBodyModel, _ isBodyMicro: Bool) { headlineBodyModel.headline?.fontStyle = .RegularMicro headlineBodyModel.headline?.textColor = Color(uiColor: .mvmCoolGray6) - headlineBodyModel.body?.fontStyle = .RegularBodySmall if isBodyMicro { headlineBodyModel.body?.fontStyle = .RegularMicro headlineBodyModel.body?.textColor = Color(uiColor: .mvmCoolGray6) + } else { + headlineBodyModel.body?.fontStyle = .RegularBodySmall } }