From 7561797211bf01c8bfb0ec6b58f3889035f71757 Mon Sep 17 00:00:00 2001 From: Kruthika KP <> Date: Wed, 11 Mar 2020 16:14:52 +0530 Subject: [PATCH 1/6] 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 47f69aefd1ab44a838f3c111c964431fcef443bb Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 12 Mar 2020 10:29:24 +0530 Subject: [PATCH 2/6] 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 9b328c3f46f456c3e6a3dd50ac8838ee681a29ba Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Mon, 16 Mar 2020 21:02:59 +0530 Subject: [PATCH 3/6] 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 35085217d5c0e71d821b3b467568c06881b8833d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Mon, 16 Mar 2020 14:32:04 -0400 Subject: [PATCH 4/6] 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 5/6] 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 6/6] 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)