From 7702b24d4ad8a749b670bab77870b0c792d3795d Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 19 Feb 2020 12:27:16 +0530 Subject: [PATCH 01/34] 19036 - List - Two Column - Price - Details initial commit. Added molecule and model class. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++++ .../TwoColumn/ListTwoColumnPriceDetails.swift | 71 +++++++++++++++++++ .../ListTwoColumnPriceDetailsModel.swift | 47 ++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 135 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03743382..bc01f6c7 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -128,6 +128,8 @@ 94F217B723E0BF6100A47C06 /* PrimaryButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */; }; 94FB966223D797DA003D482B /* MFTextButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94FB966023D797DA003D482B /* MFTextButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; + AAB04E4E23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */; }; + AAB04E5023FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -451,6 +453,8 @@ 94F217B523E0BF6100A47C06 /* PrimaryButtonView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrimaryButtonView.m; sourceTree = ""; }; 94FB966023D797DA003D482B /* MFTextButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFTextButton.h; sourceTree = ""; }; 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; + AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = ""; }; + AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -782,6 +786,15 @@ name = "Recovered References"; sourceTree = ""; }; + AAB04E4C23FCE7AC007C79B0 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + AAB04E4D23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift */, + AAB04E4F23FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; D213347423842FE3008E41B3 /* Controllers */ = { isa = PBXGroup; children = ( @@ -980,6 +993,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + AAB04E4C23FCE7AC007C79B0 /* TwoColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1625,6 +1639,7 @@ D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, + AAB04E5023FCE7FB007C79B0 /* ListTwoColumnPriceDetailsModel.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, @@ -1678,6 +1693,7 @@ 0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, 01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */, + AAB04E4E23FCE7ED007C79B0 /* ListTwoColumnPriceDetails.swift in Sources */, 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, 944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift new file mode 100644 index 00000000..804918b2 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -0,0 +1,71 @@ +// +// ListTwoColumnPriceDetails.swift +// MVMCoreUI +// +// Created by Lekshmi S on 19/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation +@objcMembers open class ListTwoColumnPriceDetails: TableViewCell { + + let leftLabel = Label.commonLabelB2(true) + let rightLabel = Label.commonLabelB2(true) + let rightSubLabel = Label.commonLabelB2(true) + let containerView = View() + + // MARK: - MFViewProtocol + open override func updateView(_ size: CGFloat) { + super.updateView(size) + containerView.updateView(size) + leftLabel.updateView(size) + rightLabel.updateView(size) + rightSubLabel.updateView(size) + } + + open override func setupView() { + super.setupView() + + guard leftLabel.superview == nil else { + return + } + containerView.translatesAutoresizingMaskIntoConstraints = false + contentView.addSubview(containerView) + containerView.addSubview(leftLabel) + containerView.addSubview(rightLabel) + containerView.addSubview(rightSubLabel) + + //containerView constraints + containerHelper.constrainView(containerView) + //leftLabel constraints + leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true + leftLabel.centerYAnchor.constraint(equalTo: rightLabel.centerYAnchor).isActive = true + //rightLabel constraints + rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true + rightLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true + //rightSubLabel constraints + rightSubLabel.topAnchor.constraint(equalTo: rightLabel.bottomAnchor).isActive = true + rightSubLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true + containerView.bottomAnchor.constraint(equalTo: rightSubLabel.bottomAnchor).isActive = true + } + + // MARK: - MVMCoreUIMoleculeViewProtocol + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListTwoColumnPriceDetailsModel else { return } + leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) + rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) + rightSubLabel.setWithModel(model.rightSubLabel, delegateObject, additionalData) + } + + open override func reset() { + super.reset() + leftLabel.reset() + rightLabel.reset() + rightSubLabel.reset() + } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 60 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift new file mode 100644 index 00000000..52bf3e10 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -0,0 +1,47 @@ +// +// ListTwoColumnPriceDetailsModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 19/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list2CTxtPrc2" + public var leftLabel: LabelModel + public var rightLabel: LabelModel + public var rightSubLabel: LabelModel + + public init(leftLabel: LabelModel, rightLabel:LabelModel, rightSubLabel: LabelModel) { + self.leftLabel = leftLabel + self.rightLabel = rightLabel + self.rightSubLabel = rightSubLabel + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case rightLabel + case rightSubLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) + 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(leftLabel, forKey: .leftLabel) + try container.encode(rightLabel, forKey: .rightLabel) + try container.encode(rightSubLabel, forKey: .rightSubLabel) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index a04f964a..c3b3523b 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -55,6 +55,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) // Vertical Combination Molecules From daeece0bbec664486a4cdba78c0594ef96f3e0e1 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 19 Feb 2020 16:39:45 +0530 Subject: [PATCH 02/34] Added contenthuggingpriority to avoid overlapping of labels. --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index 804918b2..e5c791eb 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -13,6 +13,7 @@ import Foundation let rightLabel = Label.commonLabelB2(true) let rightSubLabel = Label.commonLabelB2(true) let containerView = View() + let spaceBetweenleftLabelAndRightlabel: CGFloat = 40.0 // MARK: - MFViewProtocol open override func updateView(_ size: CGFloat) { @@ -40,9 +41,14 @@ import Foundation //leftLabel constraints leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true leftLabel.centerYAnchor.constraint(equalTo: rightLabel.centerYAnchor).isActive = true + leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) + leftLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) //rightLabel constraints + rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenleftLabelAndRightlabel).isActive = true rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true rightLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true + rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) + rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal) //rightSubLabel constraints rightSubLabel.topAnchor.constraint(equalTo: rightLabel.bottomAnchor).isActive = true rightSubLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true From 212e61885231665d4ed2862fa74f76b6486d668d Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 20 Feb 2020 18:55:53 +0530 Subject: [PATCH 03/34] File changes --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 281a0672..898e1078 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -96,6 +96,8 @@ 0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; + 522679EF23FEC02400906CBA /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679ED23FEC02300906CBA /* ListTwoColumnPriceDetailsModel.swift */; }; + 522679F023FEC02400906CBA /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679EE23FEC02300906CBA /* ListTwoColumnPriceDetails.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; @@ -422,6 +424,8 @@ 0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = ""; }; 31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = ""; }; + 522679ED23FEC02300906CBA /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = ""; }; + 522679EE23FEC02300906CBA /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; @@ -755,6 +759,15 @@ path = Views; sourceTree = ""; }; + 522679E823FEBD6D00906CBA /* TwoColumn */ = { + isa = PBXGroup; + children = ( + 522679EE23FEC02300906CBA /* ListTwoColumnPriceDetails.swift */, + 522679ED23FEC02300906CBA /* ListTwoColumnPriceDetailsModel.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; 946EE1B5237B663A0036751F /* Extensions */ = { isa = PBXGroup; children = ( @@ -994,6 +1007,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 522679E823FEBD6D00906CBA /* TwoColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1618,6 +1632,7 @@ 0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */, 943784F5236B77BB006A1E82 /* GraphView.swift in Sources */, 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */, + 522679EF23FEC02400906CBA /* ListTwoColumnPriceDetailsModel.swift in Sources */, 94C661DA23CCF4FB00D9FE5B /* UIColor+Extension.swift in Sources */, D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */, D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, @@ -1731,6 +1746,7 @@ 0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */, D29DF2EF21ECEAE1003B2FB9 /* MFFonts.m in Sources */, D22479942316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift in Sources */, + 522679F023FEC02400906CBA /* ListTwoColumnPriceDetails.swift in Sources */, D2B18B94236214AD00A9AEDC /* NavigationController.swift in Sources */, D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */, D282AACB2243C61700C46919 /* ButtonView.swift in Sources */, From 607959bd1bf5b3577b871eb47387b189bc75d248 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 20 Feb 2020 19:35:45 +0530 Subject: [PATCH 04/34] Constraint changes. --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index e5c791eb..5b3a27df 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -26,21 +26,20 @@ import Foundation open override func setupView() { super.setupView() - guard leftLabel.superview == nil else { return } containerView.translatesAutoresizingMaskIntoConstraints = false - contentView.addSubview(containerView) containerView.addSubview(leftLabel) containerView.addSubview(rightLabel) containerView.addSubview(rightSubLabel) - + contentView.addSubview(containerView) //containerView constraints containerHelper.constrainView(containerView) + //leftLabel constraints leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true - leftLabel.centerYAnchor.constraint(equalTo: rightLabel.centerYAnchor).isActive = true + leftLabel.topAnchor.constraint(equalTo: rightLabel.topAnchor).isActive = true leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) leftLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) //rightLabel constraints From b08db78d099fa64da6ec7ccc0fa313ef86465d8d Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Mon, 24 Feb 2020 11:46:44 +0530 Subject: [PATCH 05/34] Added constraints. --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index 5b3a27df..ae83dff3 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -40,8 +40,7 @@ import Foundation //leftLabel constraints leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true leftLabel.topAnchor.constraint(equalTo: rightLabel.topAnchor).isActive = true - leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal) - leftLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 901), for: .horizontal) + containerView.bottomAnchor.constraint(equalTo: leftLabel.bottomAnchor).isActive = true //rightLabel constraints rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenleftLabelAndRightlabel).isActive = true rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true @@ -51,7 +50,7 @@ import Foundation //rightSubLabel constraints rightSubLabel.topAnchor.constraint(equalTo: rightLabel.bottomAnchor).isActive = true rightSubLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true - containerView.bottomAnchor.constraint(equalTo: rightSubLabel.bottomAnchor).isActive = true + containerView.bottomAnchor.constraint(greaterThanOrEqualTo: rightSubLabel.bottomAnchor).isActive = true } // MARK: - MVMCoreUIMoleculeViewProtocol From 758279f30aa1d37f0ef3a7a3675a969240f8451d Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Mon, 24 Feb 2020 15:55:46 +0530 Subject: [PATCH 06/34] 18979 - List - Two Column - Compare Changes story initial commit. Added molecule and model class. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ .../ListTwoColumnCompareChanges.swift | 135 ++++++++++++++++++ .../ListTwoColumnCompareChangesModel.swift | 83 +++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 227 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 4afd3a24..a5a8d783 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -132,6 +132,8 @@ 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; + AA3320F42403A9B20052BBAC /* ListTwoColumnCompareChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3320F32403A9B20052BBAC /* ListTwoColumnCompareChanges.swift */; }; + AA3320F62403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3320F52403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; @@ -461,6 +463,8 @@ 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; + AA3320F32403A9B20052BBAC /* ListTwoColumnCompareChanges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChanges.swift; sourceTree = ""; }; + AA3320F52403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChangesModel.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = ""; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = ""; }; @@ -1007,6 +1011,8 @@ isa = PBXGroup; children = ( D22B38ED23F4E11100490EF6 /* ThreeColumn */, + AA3320F32403A9B20052BBAC /* ListTwoColumnCompareChanges.swift */, + AA3320F52403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift */, ); path = SectionDividers; sourceTree = ""; @@ -1775,6 +1781,7 @@ 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, + AA3320F42403A9B20052BBAC /* ListTwoColumnCompareChanges.swift in Sources */, C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */, 94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, @@ -1787,6 +1794,7 @@ D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */, D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, + AA3320F62403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift in Sources */, C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */, D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */, D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift new file mode 100644 index 00000000..36e30738 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift @@ -0,0 +1,135 @@ +// +// ListTwoColumnCompareChanges.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListTwoColumnCompareChanges: TableViewCell { + + //------------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + + let leftHeadline1 = Label.commonLabelB1(true) + let leftHeadline2 = Label.commonLabelB1(true) + let leftHeadline3 = Label.commonLabelB1(true) + let leftBody = Label.commonLabelB2(true) + let leftLink = Link() + let rightHeadline1 = Label.commonLabelB1(true) + let rightHeadline2 = Label.commonLabelB1(true) + let rightHeadline3 = Label.commonLabelB1(true) + let rightBody = Label.commonLabelB2(true) + let rightLink = Link() + let containerView = View() + let leftVerticalStack = UIStackView() + let rightVerticalStack = UIStackView() + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + containerView.updateView(size) + leftHeadline1.updateView(size) + leftHeadline2.updateView(size) + leftHeadline3.updateView(size) + leftBody.updateView(size) + leftLink.updateView(size) + rightHeadline1.updateView(size) + rightHeadline2.updateView(size) + rightHeadline3.updateView(size) + rightBody.updateView(size) + rightLink.updateView(size) + } + + open override func setupView() { + super.setupView() + guard leftHeadline1.superview == nil else { + return + } + containerView.translatesAutoresizingMaskIntoConstraints = false + leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false + rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false + leftVerticalStack.addArrangedSubview(leftHeadline1) + leftVerticalStack.addArrangedSubview(leftHeadline2) + leftVerticalStack.addArrangedSubview(leftHeadline3) + leftVerticalStack.addArrangedSubview(leftBody) + leftVerticalStack.addArrangedSubview(leftLink) + leftVerticalStack.axis = .vertical + leftVerticalStack.alignment = .leading + rightVerticalStack.addArrangedSubview(rightHeadline1) + rightVerticalStack.addArrangedSubview(rightHeadline2) + rightVerticalStack.addArrangedSubview(rightHeadline3) + rightVerticalStack.addArrangedSubview(rightBody) + rightVerticalStack.addArrangedSubview(rightLink) + rightVerticalStack.axis = .vertical + rightVerticalStack.alignment = .leading + containerView.addSubview(leftVerticalStack) + containerView.addSubview(rightVerticalStack) + + //containerView constraints + contentView.addSubview(containerView) + containerHelper.constrainView(containerView) + + //leftVerticalStack constraints + leftVerticalStack.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true + leftVerticalStack.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true + leftVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: 0.45).isActive = true + containerView.bottomAnchor.constraint(greaterThanOrEqualTo: leftVerticalStack.bottomAnchor).isActive = true + leftVerticalStack.setCustomSpacing(5.0, after: leftHeadline1) + leftVerticalStack.setCustomSpacing(5.0, after: leftHeadline2) + leftVerticalStack.setCustomSpacing(5.0, after: leftBody) + + //rightVerticalStack constraints + rightVerticalStack.topAnchor.constraint(equalTo: leftVerticalStack.topAnchor).isActive = true + rightVerticalStack.leadingAnchor.constraint(equalTo: leftVerticalStack.trailingAnchor).isActive = true + rightVerticalStack.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true + rightVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: 0.45).isActive = true + containerView.bottomAnchor.constraint(greaterThanOrEqualTo: rightVerticalStack.bottomAnchor).isActive = true + rightVerticalStack.setCustomSpacing(5.0, after: rightHeadline1) + rightVerticalStack.setCustomSpacing(5.0, after: rightHeadline2) + rightVerticalStack.setCustomSpacing(5.0, after: rightBody) + } + + //------------------------------------------------------ + // MARK: - Molecule + //------------------------------------------------------ + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListTwoColumnCompareChangesModel else { return } + leftHeadline1.setWithModel(model.leftHeadline1, delegateObject, additionalData) + leftHeadline2.setWithModel(model.leftHeadline2, delegateObject, additionalData) + leftHeadline3.setWithModel(model.leftHeadline3, delegateObject, additionalData) + leftBody.setWithModel(model.leftBody, delegateObject, additionalData) + leftLink.setWithModel(model.leftLink, delegateObject, additionalData) + rightHeadline1.setWithModel(model.rightHeadline1, delegateObject, additionalData) + rightHeadline2.setWithModel(model.rightHeadline2, delegateObject, additionalData) + rightHeadline3.setWithModel(model.rightHeadline3, delegateObject, additionalData) + rightBody.setWithModel(model.rightBody, delegateObject, additionalData) + rightLink.setWithModel(model.rightLink, delegateObject, additionalData) + } + + open override func reset() { + super.reset() + leftHeadline1.reset() + leftHeadline2.reset() + leftHeadline3.reset() + leftBody.reset() + leftLink.reset() + rightHeadline1.reset() + rightHeadline2.reset() + rightHeadline3.reset() + rightBody.reset() + rightLink.reset() + } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift new file mode 100644 index 00000000..5e4e876c --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift @@ -0,0 +1,83 @@ +// +// ListTwoColumnCompareChangesModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 24/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnCompareChangesModel: ListItemModel, MoleculeModelProtocol { + + public static var identifier: String = "list2CCmpr1" + public var leftHeadline1: LabelModel + public var leftHeadline2: LabelModel + public var leftHeadline3: LabelModel + public var leftBody: LabelModel + public var leftLink: LinkModel + public var rightHeadline1: LabelModel + public var rightHeadline2: LabelModel + public var rightHeadline3: LabelModel + public var rightBody: LabelModel + public var rightLink: LinkModel + + public init(leftHeadline1: LabelModel, leftHeadline2: LabelModel, leftHeadline3: LabelModel, leftBody: LabelModel, leftLink: LinkModel, rightHeadline1: LabelModel, rightHeadline2: LabelModel, rightHeadline3: LabelModel, rightBody: LabelModel, rightLink: LinkModel) { + self.leftHeadline1 = leftHeadline1 + self.leftHeadline2 = leftHeadline2 + self.leftHeadline3 = leftHeadline3 + self.leftBody = leftBody + self.leftLink = leftLink + self.rightHeadline1 = rightHeadline1 + self.rightHeadline2 = rightHeadline2 + self.rightHeadline3 = rightHeadline3 + self.rightBody = rightBody + self.rightLink = rightLink + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftHeadline1 + case leftHeadline2 + case leftHeadline3 + case leftBody + case leftLink + case rightHeadline1 + case rightHeadline2 + case rightHeadline3 + case rightBody + case rightLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftHeadline1 = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline1) + leftHeadline2 = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline2) + leftHeadline3 = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline3) + leftBody = try typeContainer.decode(LabelModel.self, forKey: .leftBody) + leftLink = try typeContainer.decode(LinkModel.self, forKey: .leftLink) + rightHeadline1 = try typeContainer.decode(LabelModel.self, forKey: .rightHeadline1) + rightHeadline2 = try typeContainer.decode(LabelModel.self, forKey: .rightHeadline2) + rightHeadline3 = try typeContainer.decode(LabelModel.self, forKey: .rightHeadline3) + rightBody = try typeContainer.decode(LabelModel.self, forKey: .rightBody) + rightLink = try typeContainer.decode(LinkModel.self, forKey: .rightLink) + 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(leftHeadline1, forKey: .leftHeadline1) + try container.encode(leftHeadline2, forKey: .leftHeadline2) + try container.encode(leftHeadline3, forKey: .leftHeadline3) + try container.encode(leftBody, forKey: .leftBody) + try container.encode(leftLink, forKey: .leftLink) + try container.encode(rightHeadline1, forKey: .rightHeadline1) + try container.encode(rightHeadline2, forKey: .rightHeadline2) + try container.encode(rightHeadline3, forKey: .rightHeadline3) + try container.encode(rightBody, forKey: .rightBody) + try container.encode(rightLink, forKey: .rightLink) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 7ae80d49..8ffc3dcf 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -55,6 +55,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) // Vertical Combination Molecules From ec9107666989735eec6c94e5e6099ad948b51671 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 27 Feb 2020 14:19:15 +0530 Subject: [PATCH 07/34] Code cleanup --- .../ListTwoColumnCompareChanges.swift | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift index 36e30738..bbf3467d 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift @@ -13,7 +13,6 @@ import Foundation //------------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - let leftHeadline1 = Label.commonLabelB1(true) let leftHeadline2 = Label.commonLabelB1(true) let leftHeadline3 = Label.commonLabelB1(true) @@ -28,30 +27,23 @@ import Foundation let leftVerticalStack = UIStackView() let rightVerticalStack = UIStackView() + //------------------------------------------------------ + // MARK: - Properties + //------------------------------------------------------ + let stackSpacing: CGFloat = 5.0 + let widthMultiplier: CGFloat = 0.45 + //------------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- - open override func updateView(_ size: CGFloat) { super.updateView(size) - containerView.updateView(size) - leftHeadline1.updateView(size) - leftHeadline2.updateView(size) - leftHeadline3.updateView(size) - leftBody.updateView(size) leftLink.updateView(size) - rightHeadline1.updateView(size) - rightHeadline2.updateView(size) - rightHeadline3.updateView(size) - rightBody.updateView(size) rightLink.updateView(size) } - + open override func setupView() { super.setupView() - guard leftHeadline1.superview == nil else { - return - } containerView.translatesAutoresizingMaskIntoConstraints = false leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false @@ -79,21 +71,21 @@ import Foundation //leftVerticalStack constraints leftVerticalStack.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true leftVerticalStack.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true - leftVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: 0.45).isActive = true + leftVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: widthMultiplier).isActive = true containerView.bottomAnchor.constraint(greaterThanOrEqualTo: leftVerticalStack.bottomAnchor).isActive = true - leftVerticalStack.setCustomSpacing(5.0, after: leftHeadline1) - leftVerticalStack.setCustomSpacing(5.0, after: leftHeadline2) - leftVerticalStack.setCustomSpacing(5.0, after: leftBody) + leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline1) + leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline2) + leftVerticalStack.setCustomSpacing(stackSpacing, after: leftBody) //rightVerticalStack constraints rightVerticalStack.topAnchor.constraint(equalTo: leftVerticalStack.topAnchor).isActive = true rightVerticalStack.leadingAnchor.constraint(equalTo: leftVerticalStack.trailingAnchor).isActive = true rightVerticalStack.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true - rightVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: 0.45).isActive = true + rightVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: widthMultiplier).isActive = true containerView.bottomAnchor.constraint(greaterThanOrEqualTo: rightVerticalStack.bottomAnchor).isActive = true - rightVerticalStack.setCustomSpacing(5.0, after: rightHeadline1) - rightVerticalStack.setCustomSpacing(5.0, after: rightHeadline2) - rightVerticalStack.setCustomSpacing(5.0, after: rightBody) + rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline1) + rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline2) + rightVerticalStack.setCustomSpacing(stackSpacing, after: rightBody) } //------------------------------------------------------ @@ -117,15 +109,15 @@ import Foundation open override func reset() { super.reset() - leftHeadline1.reset() - leftHeadline2.reset() - leftHeadline3.reset() - leftBody.reset() + leftHeadline1.styleB1(true) + leftHeadline2.styleB1(true) + leftHeadline3.styleB1(true) + leftBody.styleB2(true) leftLink.reset() - rightHeadline1.reset() - rightHeadline2.reset() - rightHeadline3.reset() - rightBody.reset() + rightHeadline1.styleB1(true) + rightHeadline2.styleB1(true) + rightHeadline3.styleB1(true) + rightBody.styleB2(true) rightLink.reset() } From 7c4401f4acd84d6a5b6e57809466f0cc2b0ece84 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 27 Feb 2020 14:30:56 +0530 Subject: [PATCH 08/34] referencing error --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 75 ------------------- .../ListTwoColumnPriceDetailsModel.swift | 47 ------------ 2 files changed, 122 deletions(-) delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift deleted file mode 100644 index ae83dff3..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ /dev/null @@ -1,75 +0,0 @@ -// -// ListTwoColumnPriceDetails.swift -// MVMCoreUI -// -// Created by Lekshmi S on 19/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation -@objcMembers open class ListTwoColumnPriceDetails: TableViewCell { - - let leftLabel = Label.commonLabelB2(true) - let rightLabel = Label.commonLabelB2(true) - let rightSubLabel = Label.commonLabelB2(true) - let containerView = View() - let spaceBetweenleftLabelAndRightlabel: CGFloat = 40.0 - - // MARK: - MFViewProtocol - open override func updateView(_ size: CGFloat) { - super.updateView(size) - containerView.updateView(size) - leftLabel.updateView(size) - rightLabel.updateView(size) - rightSubLabel.updateView(size) - } - - open override func setupView() { - super.setupView() - guard leftLabel.superview == nil else { - return - } - containerView.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(leftLabel) - containerView.addSubview(rightLabel) - containerView.addSubview(rightSubLabel) - contentView.addSubview(containerView) - //containerView constraints - containerHelper.constrainView(containerView) - - //leftLabel constraints - leftLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true - leftLabel.topAnchor.constraint(equalTo: rightLabel.topAnchor).isActive = true - containerView.bottomAnchor.constraint(equalTo: leftLabel.bottomAnchor).isActive = true - //rightLabel constraints - rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leftLabel.trailingAnchor, constant: spaceBetweenleftLabelAndRightlabel).isActive = true - rightLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true - rightLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true - rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal) - rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 902), for: .horizontal) - //rightSubLabel constraints - rightSubLabel.topAnchor.constraint(equalTo: rightLabel.bottomAnchor).isActive = true - rightSubLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true - containerView.bottomAnchor.constraint(greaterThanOrEqualTo: rightSubLabel.bottomAnchor).isActive = true - } - - // MARK: - MVMCoreUIMoleculeViewProtocol - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? ListTwoColumnPriceDetailsModel else { return } - leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) - rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) - rightSubLabel.setWithModel(model.rightSubLabel, delegateObject, additionalData) - } - - open override func reset() { - super.reset() - leftLabel.reset() - rightLabel.reset() - rightSubLabel.reset() - } - - public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 60 - } -} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift deleted file mode 100644 index 52bf3e10..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// ListTwoColumnPriceDetailsModel.swift -// MVMCoreUI -// -// Created by Lekshmi S on 19/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list2CTxtPrc2" - public var leftLabel: LabelModel - public var rightLabel: LabelModel - public var rightSubLabel: LabelModel - - public init(leftLabel: LabelModel, rightLabel:LabelModel, rightSubLabel: LabelModel) { - self.leftLabel = leftLabel - self.rightLabel = rightLabel - self.rightSubLabel = rightSubLabel - super.init() - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case leftLabel - case rightLabel - case rightSubLabel - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) - rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) - rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) - 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(leftLabel, forKey: .leftLabel) - try container.encode(rightLabel, forKey: .rightLabel) - try container.encode(rightSubLabel, forKey: .rightSubLabel) - } -} From d507e66d13b300b4d6347066b41817cde864bd82 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 27 Feb 2020 19:06:49 +0530 Subject: [PATCH 09/34] Added ListTwoCloumnPriceDetails molecule --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++ .../TwoColumn/ListTwoColumnPriceDetails.swift | 55 +++++++++++++++++++ .../ListTwoColumnPriceDetailsModel.swift | 47 ++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 119 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 95bd45b6..873d694f 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -101,6 +101,8 @@ 52267A0723FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; + 525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */; }; + 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; @@ -435,6 +437,8 @@ 52267A0623FFE25000906CBA /* ListOneColumnFullWidthTextAllTextAndLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinks.swift; sourceTree = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; + 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = ""; }; + 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -781,6 +785,15 @@ path = OneColumn; sourceTree = ""; }; + 525239BE2407BCE500454969 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */, + 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; 946EE1B5237B663A0036751F /* Extensions */ = { isa = PBXGroup; children = ( @@ -1024,6 +1037,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 525239BE2407BCE500454969 /* TwoColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1716,6 +1730,7 @@ 012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */, D2E2A9A123E095AB000B42E6 /* ButtonModelProtocol.swift in Sources */, 94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */, + 525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */, D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, 017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */, @@ -1860,6 +1875,7 @@ D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */, 948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */, 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */, + 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */, D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */, D2E2A9A323E096B1000B42E6 /* DisableableModelProtocol.swift in Sources */, D29DF11821E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift new file mode 100644 index 00000000..0a84a97c --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -0,0 +1,55 @@ +// +// ListTwoColumnPriceDetails.swift +// MVMCoreUI +// +// Created by Lekshmi S on 19/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +@objcMembers open class ListTwoColumnPriceDetails: TableViewCell { + + let leftLabel = Label.commonLabelB2(true) + let rightLabel = Label.commonLabelB2(true) + let rightSubLabel = Label.commonLabelB2(true) + let containerView = View() + let verticalStack = UIStackView() + + // MARK: - MFViewProtocol + open override func setupView() { + super.setupView() + + rightLabel.numberOfLines = 1 + rightSubLabel.numberOfLines = 1 + verticalStack.translatesAutoresizingMaskIntoConstraints = false + containerView.addSubview(leftLabel) + verticalStack.addArrangedSubview(rightLabel) + verticalStack.addArrangedSubview(rightSubLabel) + verticalStack.axis = .vertical + verticalStack.alignment = .trailing + containerView.addSubview(verticalStack) + addMolecule(containerView) + NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: verticalStack, alignTop: true) + } + + // MARK: - MVMCoreUIMoleculeViewProtocol + open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListTwoColumnPriceDetailsModel else { return } + leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) + rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) + rightSubLabel.setWithModel(model.rightSubLabel, delegateObject, additionalData) + } + + open override func reset() { + super.reset() + leftLabel.styleB2(true) + rightLabel.styleB2(true) + rightSubLabel.styleB2(true) + } + + open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 90 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift new file mode 100644 index 00000000..52bf3e10 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -0,0 +1,47 @@ +// +// ListTwoColumnPriceDetailsModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 19/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list2CTxtPrc2" + public var leftLabel: LabelModel + public var rightLabel: LabelModel + public var rightSubLabel: LabelModel + + public init(leftLabel: LabelModel, rightLabel:LabelModel, rightSubLabel: LabelModel) { + self.leftLabel = leftLabel + self.rightLabel = rightLabel + self.rightSubLabel = rightSubLabel + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftLabel + case rightLabel + case rightSubLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) + 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(leftLabel, forKey: .leftLabel) + try container.encode(rightLabel, forKey: .rightLabel) + try container.encode(rightSubLabel, forKey: .rightSubLabel) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 30efb2f7..42b93a12 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -55,6 +55,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) From 1c8c452fbed209cd2c8b74d1fd747ccb80954bf3 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 28 Feb 2020 12:28:49 +0530 Subject: [PATCH 10/34] Created folder structure --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++++++++++-- .../ListTwoColumnCompareChanges.swift | 0 .../ListTwoColumnCompareChangesModel.swift | 0 3 files changed, 10 insertions(+), 2 deletions(-) rename MVMCoreUI/Molecules/DesignedComponents/SectionDividers/{ => TwoColumn}/ListTwoColumnCompareChanges.swift (100%) rename MVMCoreUI/Molecules/DesignedComponents/SectionDividers/{ => TwoColumn}/ListTwoColumnCompareChangesModel.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index ac07d53c..a74f1bc6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -848,6 +848,15 @@ path = RightVariable; sourceTree = ""; }; + AAC3DC442408F14B00807E91 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + AA3320F52403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift */, + AA3320F32403A9B20052BBAC /* ListTwoColumnCompareChanges.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; D213347423842FE3008E41B3 /* Controllers */ = { isa = PBXGroup; children = ( @@ -1050,9 +1059,8 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + AAC3DC442408F14B00807E91 /* TwoColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, - AA3320F32403A9B20052BBAC /* ListTwoColumnCompareChanges.swift */, - AA3320F52403A9D10052BBAC /* ListTwoColumnCompareChangesModel.swift */, ); path = SectionDividers; sourceTree = ""; diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChanges.swift rename to MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChangesModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ListTwoColumnCompareChangesModel.swift rename to MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChangesModel.swift From 188277742a5d1be482960222b0ed18e6cc6d4463 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 2 Mar 2020 16:44:49 +0530 Subject: [PATCH 11/34] Code refactoring. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++++++ .../ListTwoColumnCompareChanges.swift | 29 +++++++++---------- .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 339735f3..c1334170 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -108,6 +108,8 @@ 5248BFED23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */; }; 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */; }; 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */; }; + 526A265C240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */; }; + 526A265E240D200500B0D828 /* ListTwoColumnCompareChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */; }; 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */; }; 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; @@ -454,6 +456,8 @@ 5248BFEB23F12E350059236A /* ListThreeColumnPlanDataDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDividerModel.swift; sourceTree = ""; }; 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDividerModel.swift; sourceTree = ""; }; 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDivider.swift; sourceTree = ""; }; + 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChangesModel.swift; sourceTree = ""; }; + 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChanges.swift; sourceTree = ""; }; 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethod.swift; sourceTree = ""; }; 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethodModel.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; @@ -825,6 +829,15 @@ path = FourColumn; sourceTree = ""; }; + 526A265A240D1FCE00B0D828 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */, + 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; 946EE1B5237B663A0036751F /* Extensions */ = { isa = PBXGroup; children = ( @@ -1071,6 +1084,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 526A265A240D1FCE00B0D828 /* TwoColumn */, 525019E3240684E500EED91C /* FourColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1801,6 +1815,7 @@ DBEFFA04225A829700230692 /* Label.swift in Sources */, D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */, 0A7EF85F23D8ABC500B2AAD1 /* MdnEntryFieldModel.swift in Sources */, + 526A265C240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift in Sources */, 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */, @@ -1859,6 +1874,7 @@ 94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */, D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */, D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */, + 526A265E240D200500B0D828 /* ListTwoColumnCompareChanges.swift in Sources */, 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */, D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */, D2D90B42240463E100DD6EC9 /* MoleculeHeaderModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift index bbf3467d..594853a3 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift @@ -91,22 +91,21 @@ import Foundation //------------------------------------------------------ // MARK: - Molecule //------------------------------------------------------ - - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) guard let model = model as? ListTwoColumnCompareChangesModel else { return } - leftHeadline1.setWithModel(model.leftHeadline1, delegateObject, additionalData) - leftHeadline2.setWithModel(model.leftHeadline2, delegateObject, additionalData) - leftHeadline3.setWithModel(model.leftHeadline3, delegateObject, additionalData) - leftBody.setWithModel(model.leftBody, delegateObject, additionalData) - leftLink.setWithModel(model.leftLink, delegateObject, additionalData) - rightHeadline1.setWithModel(model.rightHeadline1, delegateObject, additionalData) - rightHeadline2.setWithModel(model.rightHeadline2, delegateObject, additionalData) - rightHeadline3.setWithModel(model.rightHeadline3, delegateObject, additionalData) - rightBody.setWithModel(model.rightBody, delegateObject, additionalData) - rightLink.setWithModel(model.rightLink, delegateObject, additionalData) + leftHeadline1.set(with: model.leftHeadline1, delegateObject, additionalData) + leftHeadline2.set(with: model.leftHeadline2, delegateObject, additionalData) + leftHeadline3.set(with: model.leftHeadline3, delegateObject, additionalData) + leftBody.set(with: model.leftBody, delegateObject, additionalData) + leftLink.set(with: model.leftLink, delegateObject, additionalData) + rightHeadline1.set(with: model.rightHeadline1, delegateObject, additionalData) + rightHeadline2.set(with: model.rightHeadline2, delegateObject, additionalData) + rightHeadline3.set(with: model.rightHeadline3, delegateObject, additionalData) + rightBody.set(with: model.rightBody, delegateObject, additionalData) + rightLink.set(with: model.rightLink, delegateObject, additionalData) } - + open override func reset() { super.reset() leftHeadline1.styleB1(true) @@ -121,7 +120,7 @@ import Foundation rightLink.reset() } - public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { return 121 } } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 34da2080..1cdf579e 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -107,6 +107,7 @@ import Foundation // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) // TODO: Need model MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DigitEntryField.self, forKey: "digitTextField" as NSString) From 361e1f043f2483249b31f6aa86c4f8a6aa334181 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 3 Mar 2020 13:27:04 +0530 Subject: [PATCH 12/34] Code cleanup. --- .../TwoColumn/ListTwoColumnCompareChanges.swift | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift index 594853a3..372e1305 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift @@ -31,7 +31,6 @@ import Foundation // MARK: - Properties //------------------------------------------------------ let stackSpacing: CGFloat = 5.0 - let widthMultiplier: CGFloat = 0.45 //------------------------------------------------------- // MARK: - View Lifecycle @@ -67,22 +66,15 @@ import Foundation //containerView constraints contentView.addSubview(containerView) containerHelper.constrainView(containerView) + NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) //leftVerticalStack constraints - leftVerticalStack.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true - leftVerticalStack.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true - leftVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: widthMultiplier).isActive = true - containerView.bottomAnchor.constraint(greaterThanOrEqualTo: leftVerticalStack.bottomAnchor).isActive = true + leftVerticalStack.widthAnchor.constraint(equalTo: rightVerticalStack.widthAnchor, multiplier: 1).isActive = true leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline1) leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline2) leftVerticalStack.setCustomSpacing(stackSpacing, after: leftBody) //rightVerticalStack constraints - rightVerticalStack.topAnchor.constraint(equalTo: leftVerticalStack.topAnchor).isActive = true - rightVerticalStack.leadingAnchor.constraint(equalTo: leftVerticalStack.trailingAnchor).isActive = true - rightVerticalStack.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true - rightVerticalStack.widthAnchor.constraint(equalTo: containerView.widthAnchor, multiplier: widthMultiplier).isActive = true - containerView.bottomAnchor.constraint(greaterThanOrEqualTo: rightVerticalStack.bottomAnchor).isActive = true rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline1) rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline2) rightVerticalStack.setCustomSpacing(stackSpacing, after: rightBody) From f21cac7a41a95b8fc99dc478d938cd36fed040ce Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 3 Mar 2020 16:06:04 +0530 Subject: [PATCH 13/34] Code cleanup --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 12 ++++++------ .../TwoColumn/ListTwoColumnPriceDetailsModel.swift | 6 ++++++ MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index 0a84a97c..8b033f27 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -34,12 +34,12 @@ import UIKit } // MARK: - MVMCoreUIMoleculeViewProtocol - open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) guard let model = model as? ListTwoColumnPriceDetailsModel else { return } - leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) - rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) - rightSubLabel.setWithModel(model.rightSubLabel, delegateObject, additionalData) + leftLabel.set(with: model.leftLabel, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) } open override func reset() { @@ -49,7 +49,7 @@ import UIKit rightSubLabel.styleB2(true) } - open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { return 90 } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift index 52bf3e10..78665414 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -21,6 +21,12 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco super.init() } + /// Defaults to set + override public func setDefaults() { + super.setDefaults() + style = "none" + } + private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 34da2080..ae66ae13 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -107,6 +107,7 @@ import Foundation // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) // TODO: Need model MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DigitEntryField.self, forKey: "digitTextField" as NSString) From 7561797211bf01c8bfb0ec6b58f3889035f71757 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 11 Mar 2020 16:14:52 +0530 Subject: [PATCH 14/34] 19006 - List - Two Column - Price Description - Files added to new branch --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++ .../ListTwoColumnPriceDescription.swift | 87 +++++++++++++++++++ .../ListTwoColumnPriceDescriptionModel.swift | 61 +++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 2 +- 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 4c4f6023..55994b17 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -114,6 +114,8 @@ 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */; }; 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */; }; 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */; }; + 8D2339C12418EFE700AA2873 /* ListTwoColumnPriceDescriptionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D2339C02418EFE700AA2873 /* ListTwoColumnPriceDescriptionModel.swift */; }; + 8D2339C32418F0CF00AA2873 /* ListTwoColumnPriceDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D2339C22418F0CF00AA2873 /* ListTwoColumnPriceDescription.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; @@ -468,6 +470,8 @@ 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethodModel.swift; sourceTree = ""; }; 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyTextModel.swift; sourceTree = ""; }; 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyText.swift; sourceTree = ""; }; + 8D2339C02418EFE700AA2873 /* ListTwoColumnPriceDescriptionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescriptionModel.swift; sourceTree = ""; }; + 8D2339C22418F0CF00AA2873 /* ListTwoColumnPriceDescription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescription.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -851,6 +855,15 @@ path = LockUps; sourceTree = ""; }; + 8D2339BF2418EFBD00AA2873 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + 8D2339C02418EFE700AA2873 /* ListTwoColumnPriceDescriptionModel.swift */, + 8D2339C22418F0CF00AA2873 /* ListTwoColumnPriceDescription.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; 94C2D9822386F3E30006CF46 /* Label */ = { isa = PBXGroup; children = ( @@ -1090,6 +1103,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 8D2339BF2418EFBD00AA2873 /* TwoColumn */, 525019E3240684E500EED91C /* FourColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1832,6 +1846,7 @@ 0A7EF85F23D8ABC500B2AAD1 /* MdnEntryFieldModel.swift in Sources */, 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, + 8D2339C12418EFE700AA2873 /* ListTwoColumnPriceDescriptionModel.swift in Sources */, D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */, @@ -1908,6 +1923,7 @@ 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, + 8D2339C32418F0CF00AA2873 /* ListTwoColumnPriceDescription.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift new file mode 100644 index 00000000..9f73dba8 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift @@ -0,0 +1,87 @@ +// +// ListTwoColumnPriceDescription.swift +// MVMCoreUI +// +// Created by Kruthika KP on 24/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class ListTwoColumnPriceDescription: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + + let leftHeadline = Label.commonLabelB1(true) + let leftBody = Label.commonLabelB2(true) + let rightLabel = Label.commonLabelB2(true) + let rightSubLabel = Label.commonLabelB2(true) + let view = View() + + let leftVerticalStack = UIStackView() + let rightVerticalStack = UIStackView() + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func updateView(_ size: CGFloat) { + super.updateView(size) + leftHeadline.updateView(size) + leftBody.updateView(size) + rightLabel.updateView(size) + rightSubLabel.updateView(size) + } + + override open func setupView() { + super.setupView() + contentView.addSubview(view) + containerHelper.constrainView(view) + + rightSubLabel.numberOfLines = 1 + + view.translatesAutoresizingMaskIntoConstraints = false + leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false + rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false + leftVerticalStack.addArrangedSubview(leftHeadline) + leftVerticalStack.addArrangedSubview(leftBody) + leftVerticalStack.axis = .vertical + leftVerticalStack.alignment = .leading + rightVerticalStack.addArrangedSubview(rightLabel) + rightVerticalStack.addArrangedSubview(rightSubLabel) + rightVerticalStack.axis = .vertical + rightVerticalStack.alignment = .trailing + view.addSubview(leftVerticalStack) + view.addSubview(rightVerticalStack) + + NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) + + } + + //---------------------------------------------------- + // MARK: - Molecule + //------------------------------------------------------ + + public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + guard let model = model as? ListTwoColumnPriceDescriptionModel else { return} + leftHeadline.set(with: model.leftHeadline, delegateObject, additionalData) + leftBody.set(with: model.leftBody, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) + + } + + public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } + + override open func reset() { + super.reset() + leftHeadline.styleB1(true) + leftBody.styleB2(true) + rightLabel.styleB2(true) + rightSubLabel.styleB2(true) + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift new file mode 100644 index 00000000..e040b99a --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift @@ -0,0 +1,61 @@ +// +// ListTwoColumnPriceDescriptionModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 26/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list2CTxtPrc1" + public var leftHeadline: LabelModel + public var leftBody: LabelModel + public var rightLabel: LabelModel + public var rightSubLabel: LabelModel + + override public func setDefaults() { + super.setDefaults() + rightLabel.hero = 0 + } + + public init(leftHeadline: LabelModel,leftBody: LabelModel, rightLabel: LabelModel, rightSubLabel: LabelModel) { + self.leftHeadline = leftHeadline + self.leftBody = leftBody + self.rightLabel = rightLabel + self.rightSubLabel = rightSubLabel + super.init() + setDefaults() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftHeadline + case leftBody + case rightLabel + case rightSubLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline) + leftBody = try typeContainer.decode(LabelModel.self, forKey: .leftBody) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) + 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(leftHeadline, forKey: .leftHeadline) + try container.encode(leftBody, forKey: .leftBody) + try container.encode(rightLabel, forKey: .rightLabel) + try container.encode(rightSubLabel, forKey: .rightSubLabel) + } +} + + + diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index f471a2e6..4e7df87b 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -110,7 +110,7 @@ import Foundation // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) - + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) // TODO: Need model MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DigitEntryField.self, forKey: "digitTextField" as NSString) MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DateDropdownEntryField.self, forKey: "dateDropdownEntryField" as NSString) From a16855527f99841a4071490e1877dbf76b4d2bca Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 11 Mar 2020 16:21:52 +0530 Subject: [PATCH 15/34] Resolved merge conflicts. --- MVMCoreUI.xcodeproj/project.pbxproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b6657933..fcc5da40 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -846,7 +846,6 @@ path = FourColumn; sourceTree = ""; }; - 525239C32407FFCC00454969 /* LockUps */ = { 525239BE2407BCE500454969 /* TwoColumn */ = { isa = PBXGroup; children = ( @@ -856,7 +855,7 @@ path = TwoColumn; sourceTree = ""; }; - 946EE1B5237B663A0036751F /* Extensions */ = { + 525239C32407FFCC00454969 /* LockUps */ = { isa = PBXGroup; children = ( 525019DB2406430700EED91C /* ListProgressBarDataModel.swift */, From f33fd320ad26310c4f0acd0c24a62758d3ae54c2 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 11 Mar 2020 16:22:48 +0530 Subject: [PATCH 16/34] Refactored code as per the changes in confluence. --- .../TwoColumn/ListTwoColumnPriceDetails.swift | 30 ++++++++----------- .../ListTwoColumnPriceDetailsModel.swift | 7 +---- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index 8b033f27..2d9051d7 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -12,25 +12,23 @@ import UIKit let leftLabel = Label.commonLabelB2(true) let rightLabel = Label.commonLabelB2(true) - let rightSubLabel = Label.commonLabelB2(true) - let containerView = View() - let verticalStack = UIStackView() + var stack: Stack + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 70, horizontalAlignment: .leading)), (view: rightLabel, model: StackItemModel(percent: 30, horizontalAlignment: .trailing))], axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + // MARK: - MFViewProtocol open override func setupView() { super.setupView() - - rightLabel.numberOfLines = 1 - rightSubLabel.numberOfLines = 1 - verticalStack.translatesAutoresizingMaskIntoConstraints = false - containerView.addSubview(leftLabel) - verticalStack.addArrangedSubview(rightLabel) - verticalStack.addArrangedSubview(rightSubLabel) - verticalStack.axis = .vertical - verticalStack.alignment = .trailing - containerView.addSubview(verticalStack) - addMolecule(containerView) - NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: verticalStack, alignTop: true) + addMolecule(stack) + stack.restack() } // MARK: - MVMCoreUIMoleculeViewProtocol @@ -39,14 +37,12 @@ import UIKit guard let model = model as? ListTwoColumnPriceDetailsModel else { return } leftLabel.set(with: model.leftLabel, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) - rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) } open override func reset() { super.reset() leftLabel.styleB2(true) rightLabel.styleB2(true) - rightSubLabel.styleB2(true) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift index 78665414..cd5b5d54 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -12,12 +12,10 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco public static var identifier: String = "list2CTxtPrc2" public var leftLabel: LabelModel public var rightLabel: LabelModel - public var rightSubLabel: LabelModel - public init(leftLabel: LabelModel, rightLabel:LabelModel, rightSubLabel: LabelModel) { + public init(leftLabel: LabelModel, rightLabel:LabelModel) { self.leftLabel = leftLabel self.rightLabel = rightLabel - self.rightSubLabel = rightSubLabel super.init() } @@ -31,14 +29,12 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco case moleculeName case leftLabel case rightLabel - case rightSubLabel } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) - rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) try super.init(from: decoder) } @@ -48,6 +44,5 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(rightLabel, forKey: .rightLabel) - try container.encode(rightSubLabel, forKey: .rightSubLabel) } } From 47f69aefd1ab44a838f3c111c964431fcef443bb Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 12 Mar 2020 10:29:24 +0530 Subject: [PATCH 17/34] code improvement --- .../TwoColumn/ListTwoColumnPriceDescription.swift | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift index 9f73dba8..95377b57 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift @@ -8,7 +8,7 @@ import Foundation -@objcMembers public class ListTwoColumnPriceDescription: TableViewCell { +@objcMembers open class ListTwoColumnPriceDescription: TableViewCell { //----------------------------------------------------- // MARK: - Outlets @@ -38,9 +38,9 @@ import Foundation super.setupView() contentView.addSubview(view) containerHelper.constrainView(view) - + + rightLabel.numberOfLines = 1 rightSubLabel.numberOfLines = 1 - view.translatesAutoresizingMaskIntoConstraints = false leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false @@ -54,26 +54,22 @@ import Foundation rightVerticalStack.alignment = .trailing view.addSubview(leftVerticalStack) view.addSubview(rightVerticalStack) - NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) - } - //---------------------------------------------------- // MARK: - Molecule //------------------------------------------------------ - public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListTwoColumnPriceDescriptionModel else { return} leftHeadline.set(with: model.leftHeadline, delegateObject, additionalData) leftBody.set(with: model.leftBody, delegateObject, additionalData) rightLabel.set(with: model.rightLabel, delegateObject, additionalData) rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) - } - public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 90 } From cf9fe4f3e8cd437f3acc6e2a709e27e823beafcc Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 12 Mar 2020 10:48:37 +0530 Subject: [PATCH 18/34] Removed extra space. --- .../SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift index 2d9051d7..96b076d1 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDetails.swift @@ -10,7 +10,7 @@ import UIKit @objcMembers open class ListTwoColumnPriceDetails: TableViewCell { - let leftLabel = Label.commonLabelB2(true) + let leftLabel = Label.commonLabelB2(true) let rightLabel = Label.commonLabelB2(true) var stack: Stack From 4f47e9fa96c6a09b35e0e3438c90df52bf44bb2a Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 12 Mar 2020 12:00:29 +0530 Subject: [PATCH 19/34] Removed extra spaces and added height constraint for stacks. --- .../TwoColumn/ListTwoColumnCompareChanges.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift index 372e1305..47d65473 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift @@ -13,16 +13,16 @@ import Foundation //------------------------------------------------------- // MARK: - Outlets //------------------------------------------------------- - let leftHeadline1 = Label.commonLabelB1(true) + let leftHeadline1 = Label.commonLabelB1(true) let leftHeadline2 = Label.commonLabelB1(true) let leftHeadline3 = Label.commonLabelB1(true) - let leftBody = Label.commonLabelB2(true) - let leftLink = Link() - let rightHeadline1 = Label.commonLabelB1(true) + let leftBody = Label.commonLabelB2(true) + let leftLink = Link() + let rightHeadline1 = Label.commonLabelB1(true) let rightHeadline2 = Label.commonLabelB1(true) let rightHeadline3 = Label.commonLabelB1(true) - let rightBody = Label.commonLabelB2(true) - let rightLink = Link() + let rightBody = Label.commonLabelB2(true) + let rightLink = Link() let containerView = View() let leftVerticalStack = UIStackView() let rightVerticalStack = UIStackView() @@ -70,6 +70,7 @@ import Foundation //leftVerticalStack constraints leftVerticalStack.widthAnchor.constraint(equalTo: rightVerticalStack.widthAnchor, multiplier: 1).isActive = true + leftVerticalStack.heightAnchor.constraint(equalTo: rightVerticalStack.heightAnchor, multiplier: 1).isActive = true leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline1) leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline2) leftVerticalStack.setCustomSpacing(stackSpacing, after: leftBody) From 6d3946f0e7541b328130211fe37d942fc34da400 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 13 Mar 2020 11:52:09 -0400 Subject: [PATCH 20/34] anyrequiredmodel --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++++ .../New/Rules/RuleAnyRequiredModel.swift | 23 +++++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 3 files changed, 28 insertions(+) create mode 100644 MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8ece6dd9..aeaac929 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -91,6 +91,7 @@ 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA6D2344FCD400D4C0BC /* CATransaction+Extension.swift */; }; 0A41BA7F23453A6400D4C0BC /* TextEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A41BA7E23453A6400D4C0BC /* TextEntryField.swift */; }; 0A5D59C223AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */; }; + 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */; }; 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6BF4712360C56C0028F841 /* BaseDropdownEntryField.swift */; }; 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; }; 0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */; }; @@ -452,6 +453,7 @@ 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 = ""; }; 0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleGuidelinesProtocol.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 = ""; }; 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButton.swift; sourceTree = ""; }; 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = ""; }; @@ -807,6 +809,7 @@ 011D95A0240453D0000E3791 /* RuleEqualsModel.swift */, 011D95A2240453F8000E3791 /* RuleRegexModel.swift */, 011D95A4240455DC000E3791 /* FormGroupRule.swift */, + 0A69F610241BDEA700F7231B /* RuleAnyRequiredModel.swift */, ); path = Rules; sourceTree = ""; @@ -1781,6 +1784,7 @@ D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */, DBC4391822442197001AB423 /* CaretView.swift in Sources */, C07065C42395677300FBF997 /* Link.swift in Sources */, + 0A69F611241BDEA700F7231B /* RuleAnyRequiredModel.swift in Sources */, D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */, D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */, D28A838923CCCFCB00DFE4FC /* LinkModel.swift in Sources */, diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift b/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift new file mode 100644 index 00000000..0eab62a7 --- /dev/null +++ b/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift @@ -0,0 +1,23 @@ +// +// RuleAnyRequiredModel.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 3/13/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + + +public class RuleAnyRequiredModel: RulesProtocol { + + public static var identifier: String = "anyRequired" + public var type: String = RuleRequiredModel.identifier + public var fields: [String] + + public func isValid(_ formField: FormFieldProtocol) -> Bool { + guard let value = formField.formFieldValue() else { return false } + + return true + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 17a9972c..640dbebe 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -124,6 +124,7 @@ import Foundation // Helper models try? ModelRegistry.register(RuleRequiredModel.self) + try? ModelRegistry.register(RuleAnyRequiredModel.self) try? ModelRegistry.register(RuleAnyValueChangedModel.self) try? ModelRegistry.register(RuleAllValueChangedModel.self) try? ModelRegistry.register(RuleEqualsModel.self) From 62fd6c988eb3428163e6437af315e609cd941ad9 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Fri, 13 Mar 2020 12:13:32 -0400 Subject: [PATCH 21/34] merge --- MVMCoreUI.xcodeproj/project.pbxproj | 25 +++++++------------ .../{New => }/FormActionFieldProtocol.swift | 0 .../{New => }/FormFieldProtocol.swift | 0 .../{New => }/FormHolderProtocol.swift | 0 .../{New => }/FormItemProtocol.swift | 0 .../{New => }/FormProtocol.swift | 0 .../{New => Rules}/Rules/FormGroupRule.swift | 0 .../Rules/RuleAllValueChangedModel.swift | 0 .../Rules/RuleAnyValueChangedModel.swift | 0 .../Rules/RuleEqualsModel.swift | 0 .../{New => Rules}/Rules/RuleRegexModel.swift | 0 .../Rules/RuleRequiredModel.swift | 0 .../{New => Rules}/Rules/RulesProtocol.swift | 0 .../{New => }/ValidProtocol.swift | 0 14 files changed, 9 insertions(+), 16 deletions(-) rename MVMCoreUI/FormUIHelpers/{New => }/FormActionFieldProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => }/FormFieldProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => }/FormHolderProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => }/FormItemProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => }/FormProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/FormGroupRule.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RuleAllValueChangedModel.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RuleAnyValueChangedModel.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RuleEqualsModel.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RuleRegexModel.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RuleRequiredModel.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => Rules}/Rules/RulesProtocol.swift (100%) rename MVMCoreUI/FormUIHelpers/{New => }/ValidProtocol.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b5985e36..e795475d 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -779,20 +779,6 @@ path = ModelProtocols; sourceTree = ""; }; - 011D9583240422BF000E3791 /* New */ = { - isa = PBXGroup; - children = ( - 011D958A24042794000E3791 /* Rules */, - 011D95882404249B000E3791 /* FormProtocol.swift */, - 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */, - 011D95AA2405C553000E3791 /* FormItemProtocol.swift */, - 011D958624042492000E3791 /* FormFieldProtocol.swift */, - 011D95A824057AC7000E3791 /* FormActionFieldProtocol.swift */, - 011D9601240DA20A000E3791 /* ValidProtocol.swift */, - ); - path = New; - sourceTree = ""; - }; 011D958A24042794000E3791 /* Rules */ = { isa = PBXGroup; children = ( @@ -804,7 +790,8 @@ 011D95A2240453F8000E3791 /* RuleRegexModel.swift */, 011D95A4240455DC000E3791 /* FormGroupRule.swift */, ); - path = Rules; + name = Rules; + path = Rules/Rules; sourceTree = ""; }; 012A88EF23985E0100FE3DA1 /* CustomPrimitives */ = { @@ -826,8 +813,14 @@ 01C74D87224298E2009C25A3 /* FormUIHelpers */ = { isa = PBXGroup; children = ( - 011D9583240422BF000E3791 /* New */, + 011D95882404249B000E3791 /* FormProtocol.swift */, + 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */, + 011D95AA2405C553000E3791 /* FormItemProtocol.swift */, + 011D958624042492000E3791 /* FormFieldProtocol.swift */, + 011D95A824057AC7000E3791 /* FormActionFieldProtocol.swift */, + 011D9601240DA20A000E3791 /* ValidProtocol.swift */, 0105618A224BBE7700E1557D /* FormValidator.swift */, + 011D958A24042794000E3791 /* Rules */, ); path = FormUIHelpers; sourceTree = ""; diff --git a/MVMCoreUI/FormUIHelpers/New/FormActionFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/FormActionFieldProtocol.swift rename to MVMCoreUI/FormUIHelpers/FormActionFieldProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/FormFieldProtocol.swift b/MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/FormFieldProtocol.swift rename to MVMCoreUI/FormUIHelpers/FormFieldProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/FormHolderProtocol.swift b/MVMCoreUI/FormUIHelpers/FormHolderProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/FormHolderProtocol.swift rename to MVMCoreUI/FormUIHelpers/FormHolderProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/FormItemProtocol.swift b/MVMCoreUI/FormUIHelpers/FormItemProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/FormItemProtocol.swift rename to MVMCoreUI/FormUIHelpers/FormItemProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/FormProtocol.swift b/MVMCoreUI/FormUIHelpers/FormProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/FormProtocol.swift rename to MVMCoreUI/FormUIHelpers/FormProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/FormGroupRule.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/FormGroupRule.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleAllValueChangedModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAllValueChangedModel.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RuleAllValueChangedModel.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAllValueChangedModel.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyValueChangedModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyValueChangedModel.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleEqualsModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RuleEqualsModel.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRegexModel.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RuleRegexModel.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRegexModel.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleRequiredModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RuleRequiredModel.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RuleRequiredModel.swift diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift rename to MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift diff --git a/MVMCoreUI/FormUIHelpers/New/ValidProtocol.swift b/MVMCoreUI/FormUIHelpers/ValidProtocol.swift similarity index 100% rename from MVMCoreUI/FormUIHelpers/New/ValidProtocol.swift rename to MVMCoreUI/FormUIHelpers/ValidProtocol.swift From f888358336380e3628fcb37c547c1a9410784750 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Fri, 13 Mar 2020 12:31:32 -0400 Subject: [PATCH 22/34] refactor --- MVMCoreUI/Atoms/TextFields/TextEntryField.swift | 2 +- MVMCoreUI/FormUIHelpers/FormValidator.swift | 2 +- .../Rules/Rules/RuleAnyValueChangedModel.swift | 4 ++-- MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift | 4 ++-- MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift index 993aed59..5df115d9 100644 --- a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atoms/TextFields/TextEntryField.swift @@ -44,7 +44,7 @@ import UIKit private var observingForChange: Bool = false - /// Validate on each entry in the textField. Default: false + /// Validate on each entry in the textField. Default: true public var validateEachCharacter: Bool = true /// Validate when user resigns editing. Default: true diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index f2cdb8ea..8977fad5 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -66,7 +66,7 @@ import MVMCore public func validate(_ groupName: String, _ actionModel: FormActionFieldProtocol, _ rules: [RulesProtocol]) { var valid = true for rule in rules { - valid = valid && rule.isValid(self) + valid = valid && rule.isValid(fieldMolecules) if !valid { break } diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift index f52dd92d..042243db 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleAnyValueChangedModel.swift @@ -18,9 +18,9 @@ public class RuleAnyValueChangedModel: RulesProtocol { return formField.baseValue != formField.formFieldValue() } - public func isValid(_ formValidator: FormValidator) -> Bool { + public func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool { for formKey in fields { - guard let formField = formValidator.formField(for: formKey) else { + guard let formField = fieldMolecules[formKey] else { continue } if isValid(formField) { diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift index ac148a29..e6b338a4 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/RuleEqualsModel.swift @@ -18,11 +18,11 @@ public class RuleEqualsModel: RulesProtocol { return false } - public func isValid(_ formValidator: FormValidator) -> Bool { + public func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool { var valid = true var compareValue: AnyHashable? for formKey in fields { - guard let formField = formValidator.formField(for: formKey) else { + guard let formField = fieldMolecules[formKey] else { continue } diff --git a/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift b/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift index 16fe77b3..4c4a716d 100644 --- a/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/Rules/Rules/RulesProtocol.swift @@ -16,7 +16,7 @@ public enum RulesCodingKey: String, CodingKey { public protocol RulesProtocol: ModelProtocol { var type: String { get set } var fields: [String] { get set } - func isValid(_ formValidator: FormValidator) -> Bool + func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool func isValid(_ formField: FormFieldProtocol) -> Bool func setValid(_ formField: FormFieldProtocol, _ isValid: Bool) } @@ -35,10 +35,10 @@ public extension RulesProtocol { return "\(RulesProtocol.self)" } - func isValid(_ formValidator: FormValidator) -> Bool { + func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool { var valid = true for formKey in fields { - guard let formField = formValidator.formField(for: formKey) else { + guard let formField = fieldMolecules[formKey] else { continue } let fieldValidity = isValid(formField) From 227248afe014fdaa738274260cbceb229a1d2c2f Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 13 Mar 2020 15:16:19 -0400 Subject: [PATCH 23/34] logic for anyRequired --- .../New/Rules/RuleAnyRequiredModel.swift | 30 +++++++++++++++++-- .../New/Rules/RulesProtocol.swift | 13 ++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift b/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift index 0eab62a7..af6f9095 100644 --- a/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift +++ b/MVMCoreUI/FormUIHelpers/New/Rules/RuleAnyRequiredModel.swift @@ -10,14 +10,40 @@ import UIKit public class RuleAnyRequiredModel: RulesProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- public static var identifier: String = "anyRequired" public var type: String = RuleRequiredModel.identifier public var fields: [String] - + + //-------------------------------------------------- + // MARK: - Methods + //-------------------------------------------------- + public func isValid(_ formField: FormFieldProtocol) -> Bool { guard let value = formField.formFieldValue() else { return false } - return true + if let valueString = value as? String { + return valueString.count > 0 + + } else if let valueBool = value as? Bool { + return valueBool + } + + return false + } + + public func isValid(_ formValidator: FormValidator) -> Bool { + + for formKey in fields { + guard let formField = formValidator.formField(for: formKey) else { continue } + + if isValid(formField) { + return true + } + } + return false } } diff --git a/MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift b/MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift index 16fe77b3..b666b895 100644 --- a/MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/New/Rules/RulesProtocol.swift @@ -18,6 +18,7 @@ public protocol RulesProtocol: ModelProtocol { var fields: [String] { get set } func isValid(_ formValidator: FormValidator) -> Bool func isValid(_ formField: FormFieldProtocol) -> Bool +// func isValid(_ fieldMolecules: [String: FormFieldProtocol]) -> Bool func setValid(_ formField: FormFieldProtocol, _ isValid: Bool) } @@ -36,22 +37,22 @@ public extension RulesProtocol { } func isValid(_ formValidator: FormValidator) -> Bool { + var valid = true + for formKey in fields { - guard let formField = formValidator.formField(for: formKey) else { - continue - } + guard let formField = formValidator.formField(for: formKey) else { continue } let fieldValidity = isValid(formField) setValid(formField, fieldValidity) valid = valid && fieldValidity } + return valid } func setValid(_ formField: FormFieldProtocol, _ isValid: Bool) { - guard let formFieldValid = formField as? ValidProtocol else { - return - } + guard let formFieldValid = formField as? ValidProtocol else { return } + formFieldValid.setValidity(isValid) } } From 86d2669beccee6fb32c84a4207c7eaca59a469c6 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 13 Mar 2020 18:05:01 -0400 Subject: [PATCH 24/34] changing so that page does not break if server doesn't send the value --- MVMCoreUI/Molecules/Items/DropDownListItemModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift b/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift index 99d493b8..0cd2f5ef 100644 --- a/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift @@ -51,7 +51,7 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - molecules = try typeContainer.decodeModels2D(codingKey: .molecules) + molecules = try typeContainer.decodeModels2DIfPresent(codingKey: .molecules) ?? [[]] dropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .dropDown) try super.init(from: decoder) } From dd19a51417bdf521533178be9a5e189a1a11b36b Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 13 Mar 2020 19:03:12 -0400 Subject: [PATCH 25/34] additional change for empty --- MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift b/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift index f9b9d976..6b6f5a32 100644 --- a/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift +++ b/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift @@ -30,7 +30,8 @@ import UIKit let self = self, let index = self.dropDown.pickerData.firstIndex(of: newValue), let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(), - let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]] + let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]], + !json2d.isEmpty && !(json2d.first?.isEmpty ?? false) else { return } if self.previousIndex != NSNotFound { From bb0f6c5eba906adeaa2cdb7c95cc85785bc0313b Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 09:42:04 -0400 Subject: [PATCH 26/34] uistack molecule extension --- MVMCoreUI.xcodeproj/project.pbxproj | 4 +++ .../Categories/UIStackView+Extension.swift | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 MVMCoreUI/Categories/UIStackView+Extension.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 66fea82f..947255d3 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -196,6 +196,7 @@ D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */; }; D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; }; + D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */; }; D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; }; D256E9932412880000360572 /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = D256E9922412880000360572 /* Header.swift */; }; D260105323CEA61600764D80 /* ToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105223CEA61600764D80 /* ToggleModel.swift */; }; @@ -560,6 +561,7 @@ D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISwitch.m; sourceTree = ""; }; D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = ""; }; D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = ""; }; + D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Extension.swift"; sourceTree = ""; }; D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; D256E9922412880000360572 /* Header.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = ""; }; D260105223CEA61600764D80 /* ToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleModel.swift; sourceTree = ""; }; @@ -1309,6 +1311,7 @@ D29DF11421E6805F003B2FB9 /* NSLayoutConstraint+MFConvenience.m */, D22479932316AE5E003FCCF9 /* NSLayoutConstraintExtension.swift */, 0AA33B33239813C50067DD0F /* UIColor+Extension.swift */, + D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */, ); path = Categories; sourceTree = ""; @@ -1845,6 +1848,7 @@ 012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */, D2E2A9A123E095AB000B42E6 /* ButtonModelProtocol.swift in Sources */, 94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */, + D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */, 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */, D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */, 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */, diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift new file mode 100644 index 00000000..ae3b7ed9 --- /dev/null +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -0,0 +1,25 @@ +// +// UIStackView+Extension.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 3/16/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +extension UIStackView: MoleculeViewProtocol { + public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {} + + public func updateView(_ size: CGFloat) { + for view in arrangedSubviews { + (view as? MVMCoreViewProtocol)?.updateView(size) + } + } + + public func reset() { + for view in arrangedSubviews { + (view as? MoleculeViewProtocol)?.reset?() + } + } +} From 9b328c3f46f456c3e6a3dd50ac8838ee681a29ba Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 16 Mar 2020 21:02:59 +0530 Subject: [PATCH 27/34] Changes made as per comments --- .../TwoColumn/ListTwoColumnPriceDescription.swift | 1 - .../TwoColumn/ListTwoColumnPriceDescriptionModel.swift | 1 - 2 files changed, 2 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift index 95377b57..f1fe61d7 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift @@ -41,7 +41,6 @@ import Foundation rightLabel.numberOfLines = 1 rightSubLabel.numberOfLines = 1 - view.translatesAutoresizingMaskIntoConstraints = false leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false leftVerticalStack.addArrangedSubview(leftHeadline) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift index e040b99a..3159a6c5 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift @@ -26,7 +26,6 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro self.rightLabel = rightLabel self.rightSubLabel = rightSubLabel super.init() - setDefaults() } private enum CodingKeys: String, CodingKey { From d8c52ab8a63a86ac0cff490a3313c28c681e32ba Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 11:58:36 -0400 Subject: [PATCH 28/34] fix molecule protocol type Update column molecule to allow for matching heights on each side. --- .../Categories/UIStackView+Extension.swift | 6 +- MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m | 2 +- .../ListTwoColumnCompareChanges.swift | 88 +++++++++---------- .../LeftRightViews/CornerLabels.swift | 2 +- .../StringAndMoleculeView.swift | 2 +- MVMCoreUI/Organisms/Stack.swift | 2 +- 6 files changed, 47 insertions(+), 55 deletions(-) diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift index ae3b7ed9..e968fd7c 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -8,9 +8,7 @@ import Foundation -extension UIStackView: MoleculeViewProtocol { - public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {} - +extension UIStackView: MVMCoreUIMoleculeViewProtocol { public func updateView(_ size: CGFloat) { for view in arrangedSubviews { (view as? MVMCoreViewProtocol)?.updateView(size) @@ -19,7 +17,7 @@ extension UIStackView: MoleculeViewProtocol { public func reset() { for view in arrangedSubviews { - (view as? MoleculeViewProtocol)?.reset?() + (view as? MVMCoreUIMoleculeViewProtocol)?.reset?() } } } diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m index 9a8f880f..f2b9976e 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m +++ b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m @@ -311,7 +311,7 @@ static CGFloat const IndicatorRectangleHeight = 4; self.currentPage = page; } -#pragma mark - MoleculeViewProtocol +#pragma mark - MVMCoreUIMoleculeViewProtocol - (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { NSString *colorString = [json string:KeyBackgroundColor]; diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift index 47d65473..c007b8c7 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnCompareChanges.swift @@ -23,9 +23,42 @@ import Foundation let rightHeadline3 = Label.commonLabelB1(true) let rightBody = Label.commonLabelB2(true) let rightLink = Link() - let containerView = View() - let leftVerticalStack = UIStackView() - let rightVerticalStack = UIStackView() + let containingStack: Stack + + //------------------------------------------------------ + // MARK: - Initializers + //------------------------------------------------------ + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + let stackHeadline1 = Stack.createStack(with: [(view: leftHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading)), + (view: rightHeadline1, model: StackItemModel(percent: 50, verticalAlignment: .leading))], + axis: .horizontal) + let stackHeadline2 = Stack.createStack(with: [(view: leftHeadline2, model: StackItemModel(percent: 50, verticalAlignment: .leading)), + (view: rightHeadline2, model: StackItemModel(percent: 50, verticalAlignment: .leading))], + axis: .horizontal) + let stackHeadline3 = Stack.createStack(with: [(view: leftHeadline3, model: StackItemModel(percent: 50, verticalAlignment: .leading)), + (view: rightHeadline3, model: StackItemModel(percent: 50, verticalAlignment: .leading))], + axis: .horizontal) + let stackBody = Stack.createStack(with: [(view: leftBody, model: StackItemModel(percent: 50, verticalAlignment: .leading)), + (view: rightBody, model: StackItemModel(percent: 50, verticalAlignment: .leading))], + axis: .horizontal) + let stackLink = Stack.createStack(with: [(view: leftLink, model: StackItemModel(percent: 50, verticalAlignment: .leading)), + (view: rightLink, model: StackItemModel(percent: 50, verticalAlignment: .leading))], + axis: .horizontal) + containingStack = Stack.createStack(with: [stackHeadline1, + stackHeadline2, + stackHeadline3, + stackBody, + stackLink], + spacing: 0) + containingStack.stackModel?.molecules[1].spacing = 5 + containingStack.stackModel?.molecules[2].spacing = 5 + containingStack.stackModel?.molecules[4].spacing = 5 + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } //------------------------------------------------------ // MARK: - Properties @@ -35,50 +68,13 @@ import Foundation //------------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- - open override func updateView(_ size: CGFloat) { - super.updateView(size) - leftLink.updateView(size) - rightLink.updateView(size) - } - open override func setupView() { super.setupView() - containerView.translatesAutoresizingMaskIntoConstraints = false - leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false - rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false - leftVerticalStack.addArrangedSubview(leftHeadline1) - leftVerticalStack.addArrangedSubview(leftHeadline2) - leftVerticalStack.addArrangedSubview(leftHeadline3) - leftVerticalStack.addArrangedSubview(leftBody) - leftVerticalStack.addArrangedSubview(leftLink) - leftVerticalStack.axis = .vertical - leftVerticalStack.alignment = .leading - rightVerticalStack.addArrangedSubview(rightHeadline1) - rightVerticalStack.addArrangedSubview(rightHeadline2) - rightVerticalStack.addArrangedSubview(rightHeadline3) - rightVerticalStack.addArrangedSubview(rightBody) - rightVerticalStack.addArrangedSubview(rightLink) - rightVerticalStack.axis = .vertical - rightVerticalStack.alignment = .leading - containerView.addSubview(leftVerticalStack) - containerView.addSubview(rightVerticalStack) - - //containerView constraints - contentView.addSubview(containerView) - containerHelper.constrainView(containerView) - NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) - - //leftVerticalStack constraints - leftVerticalStack.widthAnchor.constraint(equalTo: rightVerticalStack.widthAnchor, multiplier: 1).isActive = true - leftVerticalStack.heightAnchor.constraint(equalTo: rightVerticalStack.heightAnchor, multiplier: 1).isActive = true - leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline1) - leftVerticalStack.setCustomSpacing(stackSpacing, after: leftHeadline2) - leftVerticalStack.setCustomSpacing(stackSpacing, after: leftBody) - - //rightVerticalStack constraints - rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline1) - rightVerticalStack.setCustomSpacing(stackSpacing, after: rightHeadline2) - rightVerticalStack.setCustomSpacing(stackSpacing, after: rightBody) + addMolecule(containingStack) + for molecule in containingStack.stackItems { + ((molecule as? StackItem)?.view as? Stack)?.restack() + } + containingStack.restack() } //------------------------------------------------------ @@ -105,12 +101,10 @@ import Foundation leftHeadline2.styleB1(true) leftHeadline3.styleB1(true) leftBody.styleB2(true) - leftLink.reset() rightHeadline1.styleB1(true) rightHeadline2.styleB1(true) rightHeadline3.styleB1(true) rightBody.styleB2(true) - rightLink.reset() } public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { diff --git a/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift b/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift index f7ae36de..bbdda6af 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift +++ b/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift @@ -152,7 +152,7 @@ import UIKit styleDefault() spaceAboveMolecule = 6.0 spaceBelowMolecule = 6.0 - (middleView as? MoleculeViewProtocol)?.reset?() + (middleView as? MVMCoreUIMoleculeViewProtocol)?.reset?() } func styleDefault() { diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift index 95392b8d..09ed8a7b 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift @@ -73,7 +73,7 @@ open class StringAndMoleculeView: View { override open func reset() { super.reset() label.reset() - (molecule as? MoleculeViewProtocol)?.reset?() + (molecule as? MVMCoreUIMoleculeViewProtocol)?.reset?() } public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { diff --git a/MVMCoreUI/Organisms/Stack.swift b/MVMCoreUI/Organisms/Stack.swift index 696964f1..8fa220ec 100644 --- a/MVMCoreUI/Organisms/Stack.swift +++ b/MVMCoreUI/Organisms/Stack.swift @@ -135,7 +135,7 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto super.reset() backgroundColor = .clear for item in stackItems { - (item as? MoleculeViewProtocol)?.reset?() + (item as? MVMCoreUIMoleculeViewProtocol)?.reset?() } } From 144ea2acf1473fb162a280588084291e6ad094a0 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Mon, 16 Mar 2020 12:03:31 -0400 Subject: [PATCH 29/34] sticky footer --- MVMCoreUI/BaseControllers/ThreeLayerTableViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/ThreeLayerTableViewController.swift b/MVMCoreUI/BaseControllers/ThreeLayerTableViewController.swift index ae3d2fac..7342e761 100644 --- a/MVMCoreUI/BaseControllers/ThreeLayerTableViewController.swift +++ b/MVMCoreUI/BaseControllers/ThreeLayerTableViewController.swift @@ -17,7 +17,7 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController { private var footerView: UIView? private var safeAreaView: UIView? var useMargins: Bool = true - var bottomViewOutsideOfScrollArea: Bool = false + public var bottomViewOutsideOfScrollArea: Bool = false private var topViewBottomConstraint: NSLayoutConstraint? private var bottomViewTopConstraint: NSLayoutConstraint? From 54a12804a51504f24a75d32d960ecc71f4d5678e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 12:52:59 -0400 Subject: [PATCH 30/34] Minor changes for testing --- MVMCoreUI.xcodeproj/project.pbxproj | 39 +++++++++++-------- .../TwoColumn/ListTwoColumnPriceDetails.swift | 30 +++++++------- .../ListTwoColumnPriceDetailsModel.swift | 6 +++ 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 694868a6..eeb7a82e 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -121,14 +121,14 @@ 525019DE2406430800EED91C /* ListProgressBarData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019DC2406430800EED91C /* ListProgressBarData.swift */; }; 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */; }; 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */; }; + 525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */; }; + 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */; }; 526A265C240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */; }; 526A265E240D200500B0D828 /* ListTwoColumnCompareChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */; }; 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */; }; 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */; }; 8D084AD02410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */; }; 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */; }; - 525239C02407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */; }; - 525239C22407BD1000454969 /* ListTwoColumnPriceDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */; }; 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; @@ -491,14 +491,14 @@ 525019DC2406430800EED91C /* ListProgressBarData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListProgressBarData.swift; sourceTree = ""; }; 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDividerModel.swift; sourceTree = ""; }; 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDivider.swift; sourceTree = ""; }; + 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = ""; }; + 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = ""; }; 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChangesModel.swift; sourceTree = ""; }; 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnCompareChanges.swift; sourceTree = ""; }; 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethod.swift; sourceTree = ""; }; 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableRadioButtonAndPaymentMethodModel.swift; sourceTree = ""; }; 8D084ACF2410BF4800951227 /* ListOneColumnFullWidthTextBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyTextModel.swift; sourceTree = ""; }; 8D084AD12410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextBodyText.swift; sourceTree = ""; }; - 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetailsModel.swift; sourceTree = ""; }; - 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDetails.swift; sourceTree = ""; }; 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaret.swift; sourceTree = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -893,17 +893,6 @@ path = FourColumn; sourceTree = ""; }; - 526A265A240D1FCE00B0D828 /* TwoColumn */ = { - isa = PBXGroup; - children = ( - 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */, - 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */, - 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */, - 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */, - ); - path = TwoColumn; - sourceTree = ""; - }; 525239C32407FFCC00454969 /* LockUps */ = { isa = PBXGroup; children = ( @@ -913,6 +902,13 @@ path = LockUps; sourceTree = ""; }; + 526A265A240D1FCE00B0D828 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + ); + path = TwoColumn; + sourceTree = ""; + }; 94C2D9822386F3E30006CF46 /* Label */ = { isa = PBXGroup; children = ( @@ -1129,6 +1125,7 @@ D22B38EA23F4E08B00490EF6 /* List */ = { isa = PBXGroup; children = ( + D22D8396241FDE4700D3DF69 /* TwoColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, AA4FC2A323F4F69600E251DB /* RightVariable */, D22B38EB23F4E0AE00490EF6 /* LeftVariable */, @@ -1154,7 +1151,6 @@ children = ( 526A265A240D1FCE00B0D828 /* TwoColumn */, 525019E3240684E500EED91C /* FourColumn */, - 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1178,6 +1174,17 @@ path = Legacy; sourceTree = ""; }; + D22D8396241FDE4700D3DF69 /* TwoColumn */ = { + isa = PBXGroup; + children = ( + 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */, + 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */, + 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */, + 525239C12407BD1000454969 /* ListTwoColumnPriceDetails.swift */, + ); + path = TwoColumn; + sourceTree = ""; + }; D260105723CF9CC500764D80 /* Doughnut */ = { isa = PBXGroup; children = ( diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index 96b076d1..6582d820 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -12,23 +12,23 @@ import UIKit let leftLabel = Label.commonLabelB2(true) let rightLabel = Label.commonLabelB2(true) - var stack: Stack + let view = MVMCoreUICommonViewsUtility.commonView() - // MARK: - Initializers - public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(percent: 70, horizontalAlignment: .leading)), (view: rightLabel, model: StackItemModel(percent: 30, horizontalAlignment: .trailing))], axis: .horizontal) - super.init(style: style, reuseIdentifier: reuseIdentifier) - } - - public required init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - MFViewProtocol open override func setupView() { super.setupView() - addMolecule(stack) - stack.restack() + view.addSubview(leftLabel) + view.addSubview(rightLabel) + NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: rightLabel, alignTop: true) + contentView.addSubview(view) + containerHelper.constrainView(view) + rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + } + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + leftLabel.updateView(size) + rightLabel.updateView(size) } // MARK: - MVMCoreUIMoleculeViewProtocol @@ -41,11 +41,13 @@ import UIKit open override func reset() { super.reset() + leftLabel.reset() + rightLabel.reset() leftLabel.styleB2(true) rightLabel.styleB2(true) } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 90 + return 15 } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift index cd5b5d54..2de46552 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift @@ -23,6 +23,12 @@ public class ListTwoColumnPriceDetailsModel: ListItemModel, MoleculeModelProtoco override public func setDefaults() { super.setDefaults() style = "none" + if leftLabel.textColor == nil { + leftLabel.textColor = Color(uiColor: .mvmCoolGray6) + } + if rightLabel.textColor == nil { + rightLabel.textColor = Color(uiColor: .mvmCoolGray6) + } } private enum CodingKeys: String, CodingKey { From 35085217d5c0e71d821b3b467568c06881b8833d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 14:32:04 -0400 Subject: [PATCH 31/34] fixes for certain devices --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++ .../Views/Label/LabelAttributeModel.swift | 2 +- .../LabelAttributeStrikeThroughModel.swift | 4 + .../ListTwoColumnPriceDescription.swift | 94 +++++++++++++++++++ .../ListTwoColumnPriceDescriptionModel.swift | 66 +++++++++++++ .../TwoColumn/ListTwoColumnPriceDetails.swift | 1 + .../Templates/MoleculeListTemplate.swift | 4 +- 7 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index eeb7a82e..796d5b7d 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -201,6 +201,8 @@ D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; }; D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */; }; + D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */; }; + D236E5B5241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */; }; D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; }; D256E9932412880000360572 /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = D256E9922412880000360572 /* Header.swift */; }; D260105323CEA61600764D80 /* ToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105223CEA61600764D80 /* ToggleModel.swift */; }; @@ -570,6 +572,8 @@ D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = ""; }; D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = ""; }; D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Extension.swift"; sourceTree = ""; }; + D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescription.swift; sourceTree = ""; }; + D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescriptionModel.swift; sourceTree = ""; }; D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; D256E9922412880000360572 /* Header.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = ""; }; D260105223CEA61600764D80 /* ToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleModel.swift; sourceTree = ""; }; @@ -1177,6 +1181,8 @@ D22D8396241FDE4700D3DF69 /* TwoColumn */ = { isa = PBXGroup; children = ( + D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */, + D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */, 526A265B240D1FF700B0D828 /* ListTwoColumnCompareChangesModel.swift */, 526A265D240D200500B0D828 /* ListTwoColumnCompareChanges.swift */, 525239BF2407BCFF00454969 /* ListTwoColumnPriceDetailsModel.swift */, @@ -1832,6 +1838,7 @@ D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D2B18B7F2360913400A9AEDC /* Control.swift in Sources */, 011D95A924057AC7000E3791 /* FormActionFieldProtocol.swift in Sources */, + D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */, 0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */, D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */, @@ -2063,6 +2070,7 @@ D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, 0A7EF86323D8AFA000B2AAD1 /* BaseDropdownEntryFieldModel.swift in Sources */, 0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */, + D236E5B5241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift in Sources */, D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, 014AA72E23C5059B006F3E93 /* StackCenteredPageTemplateModel.swift in Sources */, diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift index ddc468b7..77f7fde6 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift @@ -32,7 +32,7 @@ import Foundation var location: Int var length: Int - init(_ location: Int, _ length: Int) { + public init(_ location: Int, _ length: Int) { self.location = location self.length = length } diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift index f69e966d..59552e18 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift @@ -19,4 +19,8 @@ import UIKit public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) } + + public override init(_ location: Int, _ length: Int) { + super.init(location, length) + } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift new file mode 100644 index 00000000..9f4f60b2 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift @@ -0,0 +1,94 @@ +// +// ListTwoColumnPriceDescription.swift +// MVMCoreUI +// +// Created by Kruthika KP on 24/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListTwoColumnPriceDescription: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + public let leftHeadline = Label.commonLabelB1(true) + public let leftBody = Label.commonLabelB2(true) + public let rightLabel = Label.commonLabelB2(true) + public let rightSubLabel = Label.commonLabelB2(true) + + public let view = MVMCoreUICommonViewsUtility.commonView() + public let leftVerticalStack: UIStackView + public let rightVerticalStack: UIStackView + + //------------------------------------------------------ + // MARK: - Initializers + //------------------------------------------------------ + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + leftVerticalStack = UIStackView(arrangedSubviews: [leftHeadline, leftBody]) + leftVerticalStack.axis = .vertical + leftVerticalStack.alignment = .leading + rightVerticalStack = UIStackView(arrangedSubviews: [rightLabel, rightSubLabel]) + rightVerticalStack.axis = .vertical + rightVerticalStack.alignment = .trailing + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func updateView(_ size: CGFloat) { + super.updateView(size) + leftVerticalStack.updateView(size) + rightVerticalStack.updateView(size) + } + + override open func setupView() { + super.setupView() + contentView.addSubview(view) + containerHelper.constrainView(view) + + leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false + rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false + rightLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) + rightSubLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) + view.addSubview(leftVerticalStack) + view.addSubview(rightVerticalStack) + NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) + + leftHeadline.numberOfLines = 1 + rightLabel.numberOfLines = 1 + rightSubLabel.numberOfLines = 1 + } + //---------------------------------------------------- + // 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? ListTwoColumnPriceDescriptionModel else { return } + leftHeadline.set(with: model.leftHeadline, delegateObject, additionalData) + leftBody.set(with: model.leftBody, delegateObject, additionalData) + rightLabel.set(with: model.rightLabel, delegateObject, additionalData) + rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) + } + + open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 80 + } + + override open func reset() { + super.reset() + leftVerticalStack.reset() + rightVerticalStack.reset() + leftHeadline.styleB1(true) + leftBody.styleB2(true) + rightLabel.styleB2(true) + rightSubLabel.styleB2(true) + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift new file mode 100644 index 00000000..c341125e --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift @@ -0,0 +1,66 @@ +// +// ListTwoColumnPriceDescriptionModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 26/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list2CTxtPrc1" + public var leftHeadline: LabelModel + public var leftBody: LabelModel + public var rightLabel: LabelModel + public var rightSubLabel: LabelModel + + override public func setDefaults() { + super.setDefaults() + rightLabel.hero = 0 + if rightSubLabel.textColor == nil { + rightSubLabel.textColor = Color(uiColor: .mvmCoolGray6) + } + if rightSubLabel.attributes == nil { + rightSubLabel.attributes = [LabelAttributeStrikeThroughModel(0, rightSubLabel.text.count)] + } + } + + public init(leftHeadline: LabelModel,leftBody: LabelModel, rightLabel: LabelModel, rightSubLabel: LabelModel) { + self.leftHeadline = leftHeadline + self.leftBody = leftBody + self.rightLabel = rightLabel + self.rightSubLabel = rightSubLabel + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case leftHeadline + case leftBody + case rightLabel + case rightSubLabel + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline) + leftBody = try typeContainer.decode(LabelModel.self, forKey: .leftBody) + rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) + rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) + 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(leftHeadline, forKey: .leftHeadline) + try container.encode(leftBody, forKey: .leftBody) + try container.encode(rightLabel, forKey: .rightLabel) + try container.encode(rightSubLabel, forKey: .rightSubLabel) + } +} + + + diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index 6582d820..610821b3 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -23,6 +23,7 @@ import UIKit contentView.addSubview(view) containerHelper.constrainView(view) rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal) + rightLabel.setContentHuggingPriority(.defaultHigh, for: .vertical) } open override func updateView(_ size: CGFloat) { diff --git a/MVMCoreUI/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Templates/MoleculeListTemplate.swift index c484fced..59e91b76 100644 --- a/MVMCoreUI/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Templates/MoleculeListTemplate.swift @@ -137,12 +137,12 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol (moleculeCell as? ModelMoleculeViewProtocol)?.set(with: moleculeInfo.molecule, delegate, nil) moleculeCell?.updateView(tableView.bounds.width) - + // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells + cell.layoutIfNeeded() return cell } open override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - if let protocolCell = cell as? MoleculeListCellProtocol { protocolCell.willDisplay() } From 779efbcd07ae2ba1d05cc42ef650c8f74401cd78 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 14:32:45 -0400 Subject: [PATCH 32/34] moved files --- .../ListTwoColumnPriceDescription.swift | 82 ------------------- .../ListTwoColumnPriceDescriptionModel.swift | 60 -------------- 2 files changed, 142 deletions(-) delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift deleted file mode 100644 index f1fe61d7..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescription.swift +++ /dev/null @@ -1,82 +0,0 @@ -// -// ListTwoColumnPriceDescription.swift -// MVMCoreUI -// -// Created by Kruthika KP on 24/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers open class ListTwoColumnPriceDescription: TableViewCell { - - //----------------------------------------------------- - // MARK: - Outlets - //------------------------------------------------------- - - let leftHeadline = Label.commonLabelB1(true) - let leftBody = Label.commonLabelB2(true) - let rightLabel = Label.commonLabelB2(true) - let rightSubLabel = Label.commonLabelB2(true) - let view = View() - - let leftVerticalStack = UIStackView() - let rightVerticalStack = UIStackView() - - //----------------------------------------------------- - // MARK: - View Lifecycle - //------------------------------------------------------- - open override func updateView(_ size: CGFloat) { - super.updateView(size) - leftHeadline.updateView(size) - leftBody.updateView(size) - rightLabel.updateView(size) - rightSubLabel.updateView(size) - } - - override open func setupView() { - super.setupView() - contentView.addSubview(view) - containerHelper.constrainView(view) - - rightLabel.numberOfLines = 1 - rightSubLabel.numberOfLines = 1 - leftVerticalStack.translatesAutoresizingMaskIntoConstraints = false - rightVerticalStack.translatesAutoresizingMaskIntoConstraints = false - leftVerticalStack.addArrangedSubview(leftHeadline) - leftVerticalStack.addArrangedSubview(leftBody) - leftVerticalStack.axis = .vertical - leftVerticalStack.alignment = .leading - rightVerticalStack.addArrangedSubview(rightLabel) - rightVerticalStack.addArrangedSubview(rightSubLabel) - rightVerticalStack.axis = .vertical - rightVerticalStack.alignment = .trailing - view.addSubview(leftVerticalStack) - view.addSubview(rightVerticalStack) - NSLayoutConstraint.pinViews(leftView: leftVerticalStack, rightView: rightVerticalStack, alignTop: true) - } - //---------------------------------------------------- - // 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? ListTwoColumnPriceDescriptionModel else { return} - leftHeadline.set(with: model.leftHeadline, delegateObject, additionalData) - leftBody.set(with: model.leftBody, delegateObject, additionalData) - rightLabel.set(with: model.rightLabel, delegateObject, additionalData) - rightSubLabel.set(with: model.rightSubLabel, delegateObject, additionalData) - } - - open override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { - return 90 - } - - override open func reset() { - super.reset() - leftHeadline.styleB1(true) - leftBody.styleB2(true) - rightLabel.styleB2(true) - rightSubLabel.styleB2(true) - } -} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift deleted file mode 100644 index 3159a6c5..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/TwoColumn/ListTwoColumnPriceDescriptionModel.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// ListTwoColumnPriceDescriptionModel.swift -// MVMCoreUI -// -// Created by Kruthika KP on 26/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list2CTxtPrc1" - public var leftHeadline: LabelModel - public var leftBody: LabelModel - public var rightLabel: LabelModel - public var rightSubLabel: LabelModel - - override public func setDefaults() { - super.setDefaults() - rightLabel.hero = 0 - } - - public init(leftHeadline: LabelModel,leftBody: LabelModel, rightLabel: LabelModel, rightSubLabel: LabelModel) { - self.leftHeadline = leftHeadline - self.leftBody = leftBody - self.rightLabel = rightLabel - self.rightSubLabel = rightSubLabel - super.init() - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case leftHeadline - case leftBody - case rightLabel - case rightSubLabel - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - leftHeadline = try typeContainer.decode(LabelModel.self, forKey: .leftHeadline) - leftBody = try typeContainer.decode(LabelModel.self, forKey: .leftBody) - rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) - rightSubLabel = try typeContainer.decode(LabelModel.self, forKey: .rightSubLabel) - 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(leftHeadline, forKey: .leftHeadline) - try container.encode(leftBody, forKey: .leftBody) - try container.encode(rightLabel, forKey: .rightLabel) - try container.encode(rightSubLabel, forKey: .rightSubLabel) - } -} - - - From 3607087ec28ab8c5f140b31f0ede3bdc715a9fcf Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 14:34:06 -0400 Subject: [PATCH 33/34] fix typo --- .../List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift index c341125e..996b1b47 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift @@ -51,7 +51,7 @@ public class ListTwoColumnPriceDescriptionModel: ListItemModel, MoleculeModelPro try super.init(from: decoder) } - public override func encode(to encoder: Encoder) throws { + 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) From f26f414a23054161e71a0d373da0851232d7ead6 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 19:47:29 -0400 Subject: [PATCH 34/34] bug fixes --- MVMCoreUI/Atoms/Views/MFLoadImageView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift index e61a5af3..d8415d2d 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atoms/Views/MFLoadImageView.swift @@ -181,7 +181,7 @@ import UIKit let widthWillChange = !MVMCoreGetterUtility.cgfequal(widthConstraint?.constant ?? 0, width ?? 0) let heightWillChange = !MVMCoreGetterUtility.cgfequal(heightConstraint?.constant ?? 0, height ?? 0) let sizeWillChange = (width == nil || height == nil) && !(size?.equalTo(imageView.image?.size ?? CGSize.zero) ?? false) - let heightChangeFromSpinner = ((height ?? size?.height) ?? 0) < loadingSpinnerHeightConstraint?.constant ?? CGFloat.leastNormalMagnitude + let heightChangeFromSpinner = (heightConstraint?.isActive ?? false) ? false : ((height ?? size?.height) ?? 0) < loadingSpinnerHeightConstraint?.constant ?? CGFloat.leastNormalMagnitude return widthWillChange || heightWillChange || sizeWillChange || heightChangeFromSpinner }