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)