From 77476e13550545a3f00ed3e90665ea0f56a9c715 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 18 Feb 2020 14:31:26 +0530 Subject: [PATCH 01/30] 19162- List - Four Column - Data Usage - Divider story initial commit. Added molecule class, model class. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++++ .../ListFourColumnDataUsageDivider.swift | 72 +++++++++++++++++++ .../ListFourColumnDataUsageDividerModel.swift | 59 +++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 148 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 03743382..1b43f48b 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 */; }; + AA84562723FBB4A80013B068 /* ListFourColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA84562623FBB4A80013B068 /* ListFourColumnDataUsageDivider.swift */; }; + AA84562923FBB4C00013B068 /* ListFourColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA84562823FBB4C00013B068 /* ListFourColumnDataUsageDividerModel.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 = ""; }; + AA84562623FBB4A80013B068 /* ListFourColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDivider.swift; sourceTree = ""; }; + AA84562823FBB4C00013B068 /* ListFourColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDividerModel.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 = ""; }; + AA84562523FBB4770013B068 /* FourColumn */ = { + isa = PBXGroup; + children = ( + AA84562623FBB4A80013B068 /* ListFourColumnDataUsageDivider.swift */, + AA84562823FBB4C00013B068 /* ListFourColumnDataUsageDividerModel.swift */, + ); + path = FourColumn; + sourceTree = ""; + }; D213347423842FE3008E41B3 /* Controllers */ = { isa = PBXGroup; children = ( @@ -980,6 +993,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + AA84562523FBB4770013B068 /* FourColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1630,6 +1644,7 @@ D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, D29DF11721E6805F003B2FB9 /* UIColor+MFConvenience.m in Sources */, D2B18B7F2360913400A9AEDC /* Control.swift in Sources */, + AA84562723FBB4A80013B068 /* ListFourColumnDataUsageDivider.swift in Sources */, 0AA33B3A2398524F0067DD0F /* Toggle.swift in Sources */, D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */, @@ -1828,6 +1843,7 @@ 0A1214A022C11A18007C7030 /* ActionDetailWithImage.swift in Sources */, D2B18B922361E65A00A9AEDC /* CoreUIObject.swift in Sources */, D29DF2BE21E7BEA4003B2FB9 /* TopTabbar.m in Sources */, + AA84562923FBB4C00013B068 /* ListFourColumnDataUsageDividerModel.swift in Sources */, 014AA72E23C5059B006F3E93 /* StackCenteredPageTemplateModel.swift in Sources */, D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */, D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift new file mode 100644 index 00000000..6fc99c94 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -0,0 +1,72 @@ +// +// ListFourColumnDataUsageDivider.swift +// MVMCoreUI +// +// Created by Lekshmi S on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { + + //------------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + let label1 = Label.commonLabelB1(true) + let label2 = Label.commonLabelB1(true) + let label3 = Label.commonLabelB1(true) + let label4 = Label.commonLabelB1(true) + let stack = Stack(frame: .zero) + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) + } + + open override func setupView() { + super.setupView() + stack.translatesAutoresizingMaskIntoConstraints = false + stack.stackItems = [StackItem(andContain: label1), StackItem(andContain: label2), StackItem(andContain: label3), StackItem(andContain: label4)] + contentView.addSubview(stack) + containerHelper.constrainView(stack) + } + + //------------------------------------------------------ + // MARK: - Molecule + //------------------------------------------------------ + open override func reset() { + super.reset() + stack.reset() + } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListFourColumnDataUsageDividerModel else { return } + label1.setWithModel(model.label1, delegateObject, additionalData) + label2.setWithModel(model.label2, delegateObject, additionalData) + label3.setWithModel(model.label3, delegateObject, additionalData) + label4.setWithModel(model.label4, delegateObject, additionalData) + + //Create a stack model to use for the internal stack and set the alignment of labels + let label1 = StackItemModel(percent: 20) + label1.horizontalAlignment = .leading + let label2 = StackItemModel(percent: 40) + label2.horizontalAlignment = .leading + let label3 = StackItemModel(percent: 20) + label3.horizontalAlignment = .leading + let label4 = StackItemModel(percent: 20) + label4.horizontalAlignment = .leading + let stackModel = StackModel(molecules: [label1, label2, label3, label4]) + stackModel.axis = .horizontal + stack.model = stackModel + stack.restack() + } + + public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 90 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift new file mode 100644 index 00000000..1277f4bb --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -0,0 +1,59 @@ +// +// ListFourColumnDataUsageDividerModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list4CDiv" + public var label1: LabelModel + public var label2: LabelModel + public var label3: LabelModel + public var label4: LabelModel + + public init(label1: LabelModel, label2: LabelModel, label3: LabelModel, label4: LabelModel) { + self.label1 = label1 + self.label2 = label2 + self.label3 = label3 + self.label4 = label4 + super.init() + setDefaults() + } + + // Defaults to set + override public func setDefaults() { + super.setDefaults() + style = "tallDivider" + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case label1 + case label2 + case label3 + case label4 + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + label1 = try typeContainer.decode(LabelModel.self, forKey: .label1) + label2 = try typeContainer.decode(LabelModel.self, forKey: .label2) + label3 = try typeContainer.decode(LabelModel.self, forKey: .label3) + label4 = try typeContainer.decode(LabelModel.self, forKey: .label4) + 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(label1, forKey: .label1) + try container.encode(label2, forKey: .label2) + try container.encode(label3, forKey: .label3) + try container.encode(label4, forKey: .label4) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index a04f964a..48ca49ee 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: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) // Vertical Combination Molecules From 43a809aba01ba461506b4925f856ce08ed177eb2 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 18 Feb 2020 16:33:28 +0530 Subject: [PATCH 02/30] Modified code as labels are optional. --- .../ListFourColumnDataUsageDividerModel.swift | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift index 1277f4bb..e07ca87f 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -10,10 +10,10 @@ import Foundation public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "list4CDiv" - public var label1: LabelModel - public var label2: LabelModel - public var label3: LabelModel - public var label4: LabelModel + public var label1: LabelModel? + public var label2: LabelModel? + public var label3: LabelModel? + public var label4: LabelModel? public init(label1: LabelModel, label2: LabelModel, label3: LabelModel, label4: LabelModel) { self.label1 = label1 @@ -40,20 +40,20 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - label1 = try typeContainer.decode(LabelModel.self, forKey: .label1) - label2 = try typeContainer.decode(LabelModel.self, forKey: .label2) - label3 = try typeContainer.decode(LabelModel.self, forKey: .label3) - label4 = try typeContainer.decode(LabelModel.self, forKey: .label4) + label1 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label1) + label2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label2) + label3 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label3) + label4 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label4) 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(label1, forKey: .label1) - try container.encode(label2, forKey: .label2) - try container.encode(label3, forKey: .label3) - try container.encode(label4, forKey: .label4) + try container.encodeIfPresent(moleculeName, forKey: .moleculeName) + try container.encodeIfPresent(label1, forKey: .label1) + try container.encodeIfPresent(label2, forKey: .label2) + try container.encodeIfPresent(label3, forKey: .label3) + try container.encodeIfPresent(label4, forKey: .label4) } } From b96b48787c97d2f4ba66462d92126354a4d67b52 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 20 Feb 2020 14:49:25 -0500 Subject: [PATCH 03/30] beginning arrow molecule --- MVMCoreUI.xcodeproj/project.pbxproj | 8 ++++ MVMCoreUI/Atoms/Views/Arrow.swift | 21 ++++++++++ MVMCoreUI/Atoms/Views/ArrowModel.swift | 54 ++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 MVMCoreUI/Atoms/Views/Arrow.swift create mode 100644 MVMCoreUI/Atoms/Views/ArrowModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 281a0672..a9f666c3 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -94,6 +94,8 @@ 0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */; }; 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */; }; 0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; }; + 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; + 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */; }; @@ -420,6 +422,8 @@ 0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryField.swift; sourceTree = ""; }; 0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDropdownEntryField.swift; sourceTree = ""; }; 0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; + 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; + 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.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 = ""; }; 5248BFEA23F12E350059236A /* ListThreeColumnPlanDataDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnPlanDataDivider.swift; sourceTree = ""; }; @@ -1283,6 +1287,8 @@ 0AA33B392398524F0067DD0F /* Toggle.swift */, D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */, 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */, + 0AE98BB423FF18D2004C5109 /* Arrow.swift */, + 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */, ); path = Views; sourceTree = ""; @@ -1785,6 +1791,7 @@ D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */, D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */, C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */, + 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */, 017BEB4223620AD20024EF95 /* FormModelProtocol.swift in Sources */, 012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */, D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, @@ -1808,6 +1815,7 @@ 01EB369323609801006832FA /* HeaderModel.swift in Sources */, D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */, 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, + 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */, D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */, 012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */, 94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */, diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift new file mode 100644 index 00000000..f2e98abb --- /dev/null +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -0,0 +1,21 @@ +// +// Arrow.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 2/20/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +class Arrow: View { + + /* + // Only override draw() if you perform custom drawing. + // An empty implementation adversely affects performance during animation. + override func draw(_ rect: CGRect) { + // Drawing code + } + */ + +} diff --git a/MVMCoreUI/Atoms/Views/ArrowModel.swift b/MVMCoreUI/Atoms/Views/ArrowModel.swift new file mode 100644 index 00000000..00e85cfb --- /dev/null +++ b/MVMCoreUI/Atoms/Views/ArrowModel.swift @@ -0,0 +1,54 @@ +// +// ArrowModel.swift +// MVMCoreUI +// +// Created by Kevin Christiano on 2/20/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +open class ArrowModel: MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "arrow" + public var backgroundColor: Color? + + public var color: Color = Color(uiColor: .mfLighterGray()) + public var direction: Bool? + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case color + case direction + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) { + self.color = color + } + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + direction = try typeContainer.decodeIfPresent(Bool.self, forKey: .direction) + + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encode(color, forKey: .color) + try container.encode(direction, forKey: .direction) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + } +} From 7891b7fdbd94cd08e0194d9bcce1c1b2df938116 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Wed, 26 Feb 2020 16:13:24 +0530 Subject: [PATCH 04/30] Added Folder --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 95bd45b6..152c1602 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -101,6 +101,7 @@ 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 */; }; + 525019E0240680AC00EED91C /* FourColumn in Resources */ = {isa = PBXBuildFile; fileRef = 525019DF240680AC00EED91C /* FourColumn */; }; 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 +436,7 @@ 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 = ""; }; + 525019DF240680AC00EED91C /* FourColumn */ = {isa = PBXFileReference; lastKnownFileType = folder; path = FourColumn; 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 = ""; }; @@ -1024,6 +1026,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 525019DF240680AC00EED91C /* FourColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1629,6 +1632,7 @@ files = ( D29DF2AF21E7B3A4003B2FB9 /* MFTextView.xib in Resources */, D29DF31C21ECECC0003B2FB9 /* NHaasGroteskDSStd-75Bd.otf in Resources */, + 525019E0240680AC00EED91C /* FourColumn in Resources */, D29DF31D21ECECC0003B2FB9 /* NHaasGroteskDSStd-55Rg.otf in Resources */, 0A21DB8E235E06EF00C160A2 /* MFDigitTextField.xib in Resources */, D29DF32C21EE8736003B2FB9 /* Localizable.strings in Resources */, From e31918c0519c0aa34e43a8506cfcaa3849eb59a6 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Wed, 26 Feb 2020 16:19:51 +0530 Subject: [PATCH 05/30] Error in referencing. --- MVMCoreUI.xcodeproj/project.pbxproj | 4 -- .../ListFourColumnDataUsageDivider.swift | 72 ------------------- .../ListFourColumnDataUsageDividerModel.swift | 59 --------------- 3 files changed, 135 deletions(-) delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 152c1602..95bd45b6 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -101,7 +101,6 @@ 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 */; }; - 525019E0240680AC00EED91C /* FourColumn in Resources */ = {isa = PBXBuildFile; fileRef = 525019DF240680AC00EED91C /* FourColumn */; }; 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 */; }; @@ -436,7 +435,6 @@ 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 = ""; }; - 525019DF240680AC00EED91C /* FourColumn */ = {isa = PBXFileReference; lastKnownFileType = folder; path = FourColumn; 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 = ""; }; @@ -1026,7 +1024,6 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( - 525019DF240680AC00EED91C /* FourColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1632,7 +1629,6 @@ files = ( D29DF2AF21E7B3A4003B2FB9 /* MFTextView.xib in Resources */, D29DF31C21ECECC0003B2FB9 /* NHaasGroteskDSStd-75Bd.otf in Resources */, - 525019E0240680AC00EED91C /* FourColumn in Resources */, D29DF31D21ECECC0003B2FB9 /* NHaasGroteskDSStd-55Rg.otf in Resources */, 0A21DB8E235E06EF00C160A2 /* MFDigitTextField.xib in Resources */, D29DF32C21EE8736003B2FB9 /* Localizable.strings in Resources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift deleted file mode 100644 index 6fc99c94..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// ListFourColumnDataUsageDivider.swift -// MVMCoreUI -// -// Created by Lekshmi S on 18/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { - - //------------------------------------------------------- - // MARK: - Outlets - //------------------------------------------------------- - let label1 = Label.commonLabelB1(true) - let label2 = Label.commonLabelB1(true) - let label3 = Label.commonLabelB1(true) - let label4 = Label.commonLabelB1(true) - let stack = Stack(frame: .zero) - - //------------------------------------------------------- - // MARK: - View Lifecycle - //------------------------------------------------------- - open override func updateView(_ size: CGFloat) { - super.updateView(size) - stack.updateView(size) - } - - open override func setupView() { - super.setupView() - stack.translatesAutoresizingMaskIntoConstraints = false - stack.stackItems = [StackItem(andContain: label1), StackItem(andContain: label2), StackItem(andContain: label3), StackItem(andContain: label4)] - contentView.addSubview(stack) - containerHelper.constrainView(stack) - } - - //------------------------------------------------------ - // MARK: - Molecule - //------------------------------------------------------ - open override func reset() { - super.reset() - stack.reset() - } - - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? ListFourColumnDataUsageDividerModel else { return } - label1.setWithModel(model.label1, delegateObject, additionalData) - label2.setWithModel(model.label2, delegateObject, additionalData) - label3.setWithModel(model.label3, delegateObject, additionalData) - label4.setWithModel(model.label4, delegateObject, additionalData) - - //Create a stack model to use for the internal stack and set the alignment of labels - let label1 = StackItemModel(percent: 20) - label1.horizontalAlignment = .leading - let label2 = StackItemModel(percent: 40) - label2.horizontalAlignment = .leading - let label3 = StackItemModel(percent: 20) - label3.horizontalAlignment = .leading - let label4 = StackItemModel(percent: 20) - label4.horizontalAlignment = .leading - let stackModel = StackModel(molecules: [label1, label2, label3, label4]) - stackModel.axis = .horizontal - stack.model = stackModel - stack.restack() - } - - public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 90 - } -} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift deleted file mode 100644 index e07ca87f..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// ListFourColumnDataUsageDividerModel.swift -// MVMCoreUI -// -// Created by Lekshmi S on 18/02/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "list4CDiv" - public var label1: LabelModel? - public var label2: LabelModel? - public var label3: LabelModel? - public var label4: LabelModel? - - public init(label1: LabelModel, label2: LabelModel, label3: LabelModel, label4: LabelModel) { - self.label1 = label1 - self.label2 = label2 - self.label3 = label3 - self.label4 = label4 - super.init() - setDefaults() - } - - // Defaults to set - override public func setDefaults() { - super.setDefaults() - style = "tallDivider" - } - - private enum CodingKeys: String, CodingKey { - case moleculeName - case label1 - case label2 - case label3 - case label4 - } - - required public init(from decoder: Decoder) throws { - let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - label1 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label1) - label2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label2) - label3 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label3) - label4 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .label4) - 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.encodeIfPresent(moleculeName, forKey: .moleculeName) - try container.encodeIfPresent(label1, forKey: .label1) - try container.encodeIfPresent(label2, forKey: .label2) - try container.encodeIfPresent(label3, forKey: .label3) - try container.encodeIfPresent(label4, forKey: .label4) - } -} From 224148d36ffd6e3f11375cf2d9abd962d7b01c46 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Wed, 26 Feb 2020 19:03:42 +0530 Subject: [PATCH 06/30] Code improvement. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 +++++ .../ListFourColumnDataUsageDivider.swift | 60 +++++++++++++++++++ .../ListFourColumnDataUsageDividerModel.swift | 59 ++++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 136 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 95bd45b6..4989a5c6 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 */; }; + 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */; }; + 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.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 = ""; }; + 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDividerModel.swift; sourceTree = ""; }; + 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListFourColumnDataUsageDivider.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 = ""; }; + 525019E3240684E500EED91C /* FourColumn */ = { + isa = PBXGroup; + children = ( + 525019E42406852100EED91C /* ListFourColumnDataUsageDividerModel.swift */, + 525019E62406853600EED91C /* ListFourColumnDataUsageDivider.swift */, + ); + path = FourColumn; + sourceTree = ""; + }; 946EE1B5237B663A0036751F /* Extensions */ = { isa = PBXGroup; children = ( @@ -1024,6 +1037,7 @@ D22B38EC23F4E10700490EF6 /* SectionDividers */ = { isa = PBXGroup; children = ( + 525019E3240684E500EED91C /* FourColumn */, 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); @@ -1758,6 +1772,7 @@ D2B18B812360945C00A9AEDC /* View.swift in Sources */, C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */, D29DF26D21E6AA0B003B2FB9 /* FLAnimatedImageView.m in Sources */, + 525019E52406852100EED91C /* ListFourColumnDataUsageDividerModel.swift in Sources */, 0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */, 94FB966323D797DA003D482B /* MFTextButton.m in Sources */, D260105323CEA61600764D80 /* ToggleModel.swift in Sources */, @@ -1818,6 +1833,7 @@ 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, + 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */, 0A21DB89235E06EF00C160A2 /* MFMdnTextField.m in Sources */, D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift new file mode 100644 index 00000000..cd103787 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -0,0 +1,60 @@ +// +// ListFourColumnDataUsageDivider.swift +// MVMCoreUI +// +// Created by Lekshmi S on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { + + // MARK: - MFViewProtocol + let label1 = Label.commonLabelB1(true) + let label2 = Label.commonLabelB1(true) + let label3 = Label.commonLabelB1(true) + let label4 = Label.commonLabelB1(true) + let stack = Stack(frame: .zero) + + // MARK: - MFViewProtocol + open override func setupView() { + super.setupView() + stack.stackItems = [StackItem(andContain: label1), + StackItem(andContain: label2), + StackItem(andContain: label3), + StackItem(andContain: label4)] + addMolecule(stack) + } + + // MARK: - MVMCoreUIMoleculeViewProtocol + open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListFourColumnDataUsageDividerModel else { return } + label1.setWithModel(model.label1, delegateObject, additionalData) + label2.setWithModel(model.label2, delegateObject, additionalData) + label3.setWithModel(model.label3, delegateObject, additionalData) + label4.setWithModel(model.label4, delegateObject, additionalData) + //Create a stack model to use for the internal stack and set the alignment of labels + let stackModel = StackModel(molecules: [StackItemModel(percent: 15, horizontalAlignment: .leading), + StackItemModel(percent: 35, horizontalAlignment: .leading), + StackItemModel(percent: 30, horizontalAlignment: .trailing), + StackItemModel(percent: 20, horizontalAlignment: .trailing)], + axis: .horizontal) + stack.model = stackModel + stack.restack() + } + + // MARK: - MVMCoreUIMoleculeViewProtocol + open override func reset() { + super.reset() + label1.styleB1(true) + label2.styleB1(true) + label3.styleB1(true) + label4.styleB1(true) + } + + open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + return 121 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift new file mode 100644 index 00000000..1277f4bb --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -0,0 +1,59 @@ +// +// ListFourColumnDataUsageDividerModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 18/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "list4CDiv" + public var label1: LabelModel + public var label2: LabelModel + public var label3: LabelModel + public var label4: LabelModel + + public init(label1: LabelModel, label2: LabelModel, label3: LabelModel, label4: LabelModel) { + self.label1 = label1 + self.label2 = label2 + self.label3 = label3 + self.label4 = label4 + super.init() + setDefaults() + } + + // Defaults to set + override public func setDefaults() { + super.setDefaults() + style = "tallDivider" + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case label1 + case label2 + case label3 + case label4 + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + label1 = try typeContainer.decode(LabelModel.self, forKey: .label1) + label2 = try typeContainer.decode(LabelModel.self, forKey: .label2) + label3 = try typeContainer.decode(LabelModel.self, forKey: .label3) + label4 = try typeContainer.decode(LabelModel.self, forKey: .label4) + 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(label1, forKey: .label1) + try container.encode(label2, forKey: .label2) + try container.encode(label3, forKey: .label3) + try container.encode(label4, forKey: .label4) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 30efb2f7..92169d58 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -56,6 +56,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) From 73bd5ebafc5596c18cf9fd48ac766209c6c7b103 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 26 Feb 2020 13:36:02 -0500 Subject: [PATCH 07/30] wipppp --- MVMCoreUI/Atoms/Views/Arrow.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index f2e98abb..2103d73f 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -8,14 +8,16 @@ import UIKit -class Arrow: View { +open class Arrow: View { - /* - // Only override draw() if you perform custom drawing. - // An empty implementation adversely affects performance during animation. - override func draw(_ rect: CGRect) { - // Drawing code + + open override func setupView() { + super.setupView() } - */ + //MARK: - MVMCoreMoleculeViewProtocol + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + guard let progressBarModel = model as? ArrowModel else { return } + + } } From 10e4711c9075d003db0d497803d553779ff2a357 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 26 Feb 2020 13:44:17 -0500 Subject: [PATCH 08/30] wipppp --- MVMCoreUI/Atoms/Views/Arrow.swift | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 2103d73f..96f2bb9a 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -9,15 +9,24 @@ import UIKit open class Arrow: View { - + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + //-------------------------------------------------- + // MARK: - Lifecycle + //-------------------------------------------------- open override func setupView() { super.setupView() } - - //MARK: - MVMCoreMoleculeViewProtocol + + //-------------------------------------------------- + // MARK: - MVMCoreMoleculeViewProtocol + //-------------------------------------------------- + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - guard let progressBarModel = model as? ArrowModel else { return } - + guard let model = model as? ArrowModel else { return } + } } From a9bec2df9c07210b651592bec7989d9fde22b726 Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Wed, 26 Feb 2020 17:45:02 -0500 Subject: [PATCH 09/30] radio model --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++++++++---- MVMCoreUI/Atoms/Views/RadioButton.swift | 14 +++++++++++--- MVMCoreUI/Atoms/Views/RadioButtonModel.swift | 17 +++++++++++++++++ MVMCoreUI/FormUIHelpers/FormValidator.swift | 2 +- ...l.swift => RadioButtonSelectionHelper.swift} | 10 +++++----- .../OtherHandlers/MoleculeObjectMapping.swift | 6 ++---- 6 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 MVMCoreUI/Atoms/Views/RadioButtonModel.swift rename MVMCoreUI/Molecules/{RadioButtonModel.swift => RadioButtonSelectionHelper.swift} (84%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 95bd45b6..1f09a870 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -12,9 +12,10 @@ 0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; }; 0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; }; 0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */; }; - 0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0116A4E4228B19640094F3ED /* RadioButtonModel.swift */; }; + 0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */; }; 011B58F023A2AA980085F53C /* ListItemModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */; }; 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */; }; + 011D95AF2407266E000E3791 /* RadioButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011D95AE2407266E000E3791 /* RadioButtonModel.swift */; }; 012A889C23889E8400FE3DA1 /* TemplateModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */; }; 012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */; }; 012A88B1238C880100FE3DA1 /* CarouselPagingModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88B0238C880100FE3DA1 /* CarouselPagingModelProtocol.swift */; }; @@ -355,9 +356,10 @@ 0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = ""; }; 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = ""; }; 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+FormParams.swift"; sourceTree = ""; }; - 0116A4E4228B19640094F3ED /* RadioButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonModel.swift; sourceTree = ""; }; + 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonSelectionHelper.swift; sourceTree = ""; }; 011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListItemModelProtocol.swift; sourceTree = ""; }; 011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropDownListItemModel.swift; sourceTree = ""; }; + 011D95AE2407266E000E3791 /* RadioButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonModel.swift; sourceTree = ""; }; 012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModelProtocol.swift; sourceTree = ""; }; 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateProtocol.swift; sourceTree = ""; }; 012A88AE238C626E00FE3DA1 /* CarouselModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselModel.swift; sourceTree = ""; }; @@ -1151,7 +1153,7 @@ D2A514662213885800345BFB /* MoleculeHeaderView.swift */, 012A88EB238F084D00FE3DA1 /* FooterModel.swift */, D274CA322236A78900B01B62 /* FooterView.swift */, - 0116A4E4228B19640094F3ED /* RadioButtonModel.swift */, + 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */, 012A88C5238DA34000FE3DA1 /* ModuleMoleculeModel.swift */, D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */, D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */, @@ -1308,6 +1310,7 @@ 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */, 0A7BAFA2232BE63400FB8E22 /* CheckboxLabel.swift */, 01004F2F22721C3800991ECC /* RadioButton.swift */, + 011D95AE2407266E000E3791 /* RadioButtonModel.swift */, D28A838223CCBD3F00DFE4FC /* CircleProgressModel.swift */, 943784F3236B77BB006A1E82 /* GraphView.swift */, 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */, @@ -1664,7 +1667,7 @@ D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */, D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */, - 0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */, + 0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */, 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */, D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */, D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */, @@ -1786,6 +1789,7 @@ D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */, 017BEB7B236763000024EF95 /* LineModel.swift in Sources */, 94C2D9A523872C350006CF46 /* LabelAttributeFontModel.swift in Sources */, + 011D95AF2407266E000E3791 /* RadioButtonModel.swift in Sources */, 017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */, D274CA332236A78900B01B62 /* FooterView.swift in Sources */, D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */, diff --git a/MVMCoreUI/Atoms/Views/RadioButton.swift b/MVMCoreUI/Atoms/Views/RadioButton.swift index 23588a4c..ac579b23 100644 --- a/MVMCoreUI/Atoms/Views/RadioButton.swift +++ b/MVMCoreUI/Atoms/Views/RadioButton.swift @@ -32,7 +32,7 @@ import UIKit return json?.optionalStringForKey("radioGroupName") ?? json?.optionalStringForKey("fieldKey") }() - lazy var radioButtonModel: RadioButtonModel? = { + lazy var radioButtonModel: RadioButtonSelectionHelper? = { [unowned self] in if let radioGroupName = radioGroupName, let radioButtonModel = delegateObject?.formValidationProtocol?.formValidatorModel?()?.radioButtonsModelByGroup[radioGroupName] { @@ -98,6 +98,14 @@ import UIKit accessibilityTraits = .button accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") } + + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? RadioButtonModel else { + return + } + setWithJSON(model.toJSON(), delegateObject: delegateObject, additionalData: additionalData) + } } // MARK: - MVMCoreUIViewConstrainingProtocol @@ -123,11 +131,11 @@ extension RadioButton { isRequired = jsonDictionary.boolForKey("required") self.delegateObject = delegateObject - let radioButtonModel = RadioButtonModel.setupForRadioButtonGroup(radioButton: self, + let radioButtonModel = RadioButtonSelectionHelper.setupForRadioButtonGroup(radioButton: self, formValidator: delegateObject?.formValidationProtocol?.formValidatorModel?()) FormValidator.setupValidation(molecule: radioButtonModel, delegate: delegateObject?.formValidationProtocol) } - + public override func reset() { super.reset() backgroundColor = .white diff --git a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift new file mode 100644 index 00000000..3150212d --- /dev/null +++ b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift @@ -0,0 +1,17 @@ +// +// RadioButtonModel.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 2/26/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + + +public class RadioButtonModel: MoleculeModelProtocol { + public static var identifier: String = "radioButton" + public var backgroundColor: Color? + public var state: Bool = true + public var fieldKey: String? +} diff --git a/MVMCoreUI/FormUIHelpers/FormValidator.swift b/MVMCoreUI/FormUIHelpers/FormValidator.swift index 8cb3d774..cff26347 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidator.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidator.swift @@ -16,7 +16,7 @@ import MVMCore weak var delegate: FormValidationProtocol? var fieldMolecules: [FormValidationFormFieldProtocol] = [] var enableDisableMolecules: [FormValidationEnableDisableProtocol] = [] - var radioButtonsModelByGroup: [String: RadioButtonModel] = [:] + var radioButtonsModelByGroup: [String: RadioButtonSelectionHelper] = [:] public func insertMolecule(_ molecule: FormValidationProtocol) { if let molecule = molecule as? FormValidationFormFieldProtocol { diff --git a/MVMCoreUI/Molecules/RadioButtonModel.swift b/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift similarity index 84% rename from MVMCoreUI/Molecules/RadioButtonModel.swift rename to MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift index bb70dec7..f20ac3b2 100644 --- a/MVMCoreUI/Molecules/RadioButtonModel.swift +++ b/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift @@ -9,18 +9,18 @@ import Foundation import UIKit -@objcMembers public class RadioButtonModel: NSObject { +@objcMembers public class RadioButtonSelectionHelper: NSObject { private var selectedRadioButton: RadioButton? private var fieldGroupName: String? - public static func setupForRadioButtonGroup(radioButton: RadioButton, formValidator: FormValidator?) -> RadioButtonModel { + public static func setupForRadioButtonGroup(radioButton: RadioButton, formValidator: FormValidator?) -> RadioButtonSelectionHelper { guard let groupName = radioButton.radioGroupName, let formValidator = formValidator else { - return RadioButtonModel() + return RadioButtonSelectionHelper() } - let radioButtonModel = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonModel() + let radioButtonModel = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper() radioButtonModel.fieldGroupName = radioButton.formFieldGroupName() formValidator.radioButtonsModelByGroup[groupName] = radioButtonModel return radioButtonModel @@ -34,7 +34,7 @@ import UIKit } // MARK: - FormValidationFormFieldProtocol -extension RadioButtonModel: FormValidationFormFieldProtocol { +extension RadioButtonSelectionHelper: FormValidationFormFieldProtocol { public func formFieldGroupName() -> String? { return selectedRadioButton?.formFieldGroupName() ?? self.fieldGroupName } diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 30efb2f7..74383529 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -50,14 +50,13 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) // Horizontal Combination Molecules 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: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - - + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) // Vertical Combination Molecules MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) @@ -106,7 +105,6 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DateDropdownEntryField.self, forKey: "dateDropdownEntryField" as NSString) MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(Checkbox.self, forKey: "checkbox" as NSString) MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(CheckboxLabel.self, forKey: "checkboxLabel" as NSString) - MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButton.self, forKey: "radioButton" as NSString) MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButtonLabel.self, forKey: "radioButtonLabel" as NSString) MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString) From 4d209d88691bacaf9fc3430488cefffc63759afd Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Thu, 27 Feb 2020 09:28:00 -0500 Subject: [PATCH 10/30] optinal --- MVMCoreUI/Atoms/Views/RadioButtonModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift index 3150212d..b061e35e 100644 --- a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift +++ b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift @@ -12,6 +12,6 @@ import Foundation public class RadioButtonModel: MoleculeModelProtocol { public static var identifier: String = "radioButton" public var backgroundColor: Color? - public var state: Bool = true + public var state: Bool? public var fieldKey: String? } From b6af3ced00202d9ec31ad62981792b048615a010 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 10:12:43 -0500 Subject: [PATCH 11/30] latest state --- MVMCoreUI/Atoms/Views/Arrow.swift | 66 +++++++++++++++++++ MVMCoreUI/Atoms/Views/ArrowModel.swift | 10 +-- .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 3 files changed, 73 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 96f2bb9a..59e6f6f9 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -13,12 +13,72 @@ open class Arrow: View { // MARK: - Properties //-------------------------------------------------- + var arrowLayer = CAShapeLayer() + var lineWidth: CGFloat = 1 + var color: UIColor = .black + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- open override func setupView() { super.setupView() + + heightAnchor.constraint(equalToConstant: 12).isActive = true + widthAnchor.constraint(equalToConstant: 12).isActive = true + + drawShapeLayer() + isOpaque = false + layer.addSublayer(arrowLayer) + arrowLayer.strokeEnd = 1 + } + + override open func layoutSubviews() { + super.layoutSubviews() + + drawShapeLayer() +// layer.cornerRadius = isRound ? cornerRadiusValue : 0 + } + + //-------------------------------------------------- + // MARK: - Drawing + //-------------------------------------------------- + + private func drawShapeLayer() { + + arrowLayer.frame = bounds + arrowLayer.strokeColor = color.cgColor + arrowLayer.fillColor = UIColor.clear.cgColor + arrowLayer.path = arrowPath() + arrowLayer.lineJoin = .miter + arrowLayer.lineCap = .butt + arrowLayer.lineWidth = lineWidth + } + + private func arrowPath() -> CGPath { + + let length = max(bounds.size.height, bounds.size.width) - 1 +// let xInsetLeft = length * 0.25 +// let yInsetTop = length * 0.3 +// let innerWidth = length - (xInsetLeft + length * 0.25) // + Right X Inset +// let innerHeight = length - (yInsetTop + length * 0.35) // + Bottom Y Inset + + var startPoint = CGPoint(x: length * 0.5, y: 1) + let pivotPoint = CGPoint(x: length, y: length * 0.5) + var endPoint = CGPoint(x: length * 0.5, y: length) + + let bezierPath = UIBezierPath() + bezierPath.move(to: startPoint) + bezierPath.addLine(to: pivotPoint) + bezierPath.addLine(to: endPoint) + + startPoint = CGPoint(x: 1, y: length * 0.5) + endPoint = CGPoint(x: length, y: length * 0.5) + + bezierPath.move(to: startPoint) + bezierPath.addLine(to: pivotPoint) + + return bezierPath.cgPath } //-------------------------------------------------- @@ -28,5 +88,11 @@ open class Arrow: View { public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let model = model as? ArrowModel else { return } + arrowLayer.transform = CATransform3DIdentity + + if let degrees = model.direction { + let radians = CGFloat(degrees * Double.pi / 180) + arrowLayer.transform = CATransform3DMakeRotation(-radians, 0.0, 0.0, 1.0) + } } } diff --git a/MVMCoreUI/Atoms/Views/ArrowModel.swift b/MVMCoreUI/Atoms/Views/ArrowModel.swift index 00e85cfb..62bf5c05 100644 --- a/MVMCoreUI/Atoms/Views/ArrowModel.swift +++ b/MVMCoreUI/Atoms/Views/ArrowModel.swift @@ -16,8 +16,8 @@ open class ArrowModel: MoleculeModelProtocol { public static var identifier: String = "arrow" public var backgroundColor: Color? - public var color: Color = Color(uiColor: .mfLighterGray()) - public var direction: Bool? + public var color: Color = Color(uiColor: .mvmBlack) + public var direction: Double? //-------------------------------------------------- // MARK: - Keys @@ -28,6 +28,7 @@ open class ArrowModel: MoleculeModelProtocol { case backgroundColor case color case direction + case size } //-------------------------------------------------- @@ -36,12 +37,13 @@ open class ArrowModel: MoleculeModelProtocol { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) { self.color = color } - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - direction = try typeContainer.decodeIfPresent(Bool.self, forKey: .direction) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + direction = try typeContainer.decodeIfPresent(Double.self, forKey: .direction) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index ac7375d7..8cabfa3f 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -50,6 +50,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) // Horizontal Combination Molecules MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) From 207d1915d53e0b9eae6a36e51c44abd9a052fda2 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Thu, 27 Feb 2020 21:37:02 +0530 Subject: [PATCH 12/30] Added ListLeftVariableRadioButtonAndPaymentMethod molecule. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ ...tVariableRadioButtonAndPaymentMethod.swift | 53 +++++++++++++++++++ ...ableRadioButtonAndPaymentMethodModel.swift | 47 ++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 109 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d9401e4d..95a73635 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -104,6 +104,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 */; }; + 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 */; }; 8D24041523E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */; }; 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */; }; @@ -444,6 +446,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 = ""; }; + 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 = ""; }; 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretModel.swift; sourceTree = ""; }; 8D448E5424050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -1036,6 +1040,8 @@ D22B38EB23F4E0AE00490EF6 /* LeftVariable */ = { isa = PBXGroup; children = ( + 52B201D124081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift */, + 52B201D024081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift */, 522679C023FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinksModel.swift */, 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, @@ -1746,6 +1752,7 @@ 012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */, D2E2A9A123E095AB000B42E6 /* ButtonModelProtocol.swift in Sources */, 94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */, + 52B201D324081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethodModel.swift in Sources */, D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, 017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */, @@ -1885,6 +1892,7 @@ D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */, 0A21DB94235E24ED00C160A2 /* DigitEntryField.swift in Sources */, + 52B201D224081CFB00D2011E /* ListLeftVariableRadioButtonAndPaymentMethod.swift in Sources */, D26C5A6B23F4A40D007AEECE /* ListItemModel.swift in Sources */, 0A21DB8D235E06EF00C160A2 /* MFDigitTextField.m in Sources */, 94AF4A4323E9D19E00676048 /* MFCaretView.m in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift new file mode 100644 index 00000000..7667340c --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -0,0 +1,53 @@ +// +// ListLeftVariableRadioButtonAndPaymentMethod.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +@objcMembers open class ListLeftVariableRadioButtonAndPaymentMethod: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //------------------------------------------------------- + let radioButton = RadioButton(frame: .zero) + let leftImage = MFLoadImageView(pinnedEdges: .all) + let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() + let stack = Stack(frame: .zero) + + //----------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + override open func setupView() { + super.setupView() + stack.stackItems = [StackItem(andContain: radioButton), + StackItem(andContain: leftImage), + StackItem(andContain: eyebrowHeadlineBodyLink)] + addMolecule(stack) + } + //---------------------------------------------------- + // MARK: - Molecule + //----------------------------------------------------- + open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.setWithModel(model, delegateObject, additionalData) + guard let model = model as? ListLeftVariableRadioButtonAndPaymentMethodModel else { return} + radioButton.setWithModel(model.radioButton, delegateObject, additionalData) + leftImage.setWithModel(model.image, delegateObject, additionalData) + eyebrowHeadlineBodyLink.setWithModel(model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + + // Create a stack model to use for the internal stack and set the alignment of labels + let stackModel = StackModel(molecules: [StackItemModel(percent:10,horizontalAlignment: .center), + StackItemModel(percent:10,horizontalAlignment: .fill), + StackItemModel(percent:80,horizontalAlignment: .leading)], + axis: .horizontal) + stack.model = stackModel + stack.restack() + } + + open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 90 + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift new file mode 100644 index 00000000..e7b41635 --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift @@ -0,0 +1,47 @@ +// +// ListLeftVariableRadioButtonAndPaymentMethodModel.swift +// MVMCoreUI +// +// Created by Kruthika KP on 27/02/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol { + public static var identifier: String = "listLVRBImg" + public var radioButton : RadioButtonModel + public var image: ImageViewModel + public var eyebrowHeadlineBodyLink : EyebrowHeadlineBodyLinkModel + + public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) { + self.radioButton = radioButton + self.image = image + self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink + super.init() + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case radioButton + case image + case eyebrowHeadlineBodyLink + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton) + image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + eyebrowHeadlineBodyLink = try typeContainer.decode(EyebrowHeadlineBodyLinkModel.self, forKey: .eyebrowHeadlineBodyLink) + 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(radioButton, forKey: .radioButton) + try container.encode(image, forKey: .image) + try container.encode(eyebrowHeadlineBodyLink, forKey: .eyebrowHeadlineBodyLink) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 6550c6f5..db741f53 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -77,6 +77,7 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) From 5640129cdfe779595c8a130f4165372303694496 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 11:44:24 -0500 Subject: [PATCH 13/30] working state of arrow --- MVMCoreUI/Atoms/Views/Arrow.swift | 66 +++++++++++--------------- MVMCoreUI/Atoms/Views/ArrowModel.swift | 21 +++++--- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 59e6f6f9..7e1a510a 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -14,8 +14,10 @@ open class Arrow: View { //-------------------------------------------------- var arrowLayer = CAShapeLayer() - var lineWidth: CGFloat = 1 - var color: UIColor = .black + + public var arrowModel: ArrowModel? { + return model as? ArrowModel + } //-------------------------------------------------- // MARK: - Lifecycle @@ -24,8 +26,8 @@ open class Arrow: View { open override func setupView() { super.setupView() - heightAnchor.constraint(equalToConstant: 12).isActive = true - widthAnchor.constraint(equalToConstant: 12).isActive = true + heightAnchor.constraint(equalToConstant: 40).isActive = true + widthAnchor.constraint(equalToConstant: 40).isActive = true drawShapeLayer() isOpaque = false @@ -33,66 +35,54 @@ open class Arrow: View { arrowLayer.strokeEnd = 1 } - override open func layoutSubviews() { - super.layoutSubviews() - - drawShapeLayer() -// layer.cornerRadius = isRound ? cornerRadiusValue : 0 - } - //-------------------------------------------------- // MARK: - Drawing //-------------------------------------------------- + open override func draw(_ rect: CGRect) { + super.draw(rect) + + arrowLayer.transform = CATransform3DIdentity + drawShapeLayer() + + if let degrees = arrowModel?.degrees { + let radians = CGFloat(degrees * Float.pi / 180) + arrowLayer.transform = CATransform3DMakeRotation(-radians, 0.0, 0.0, 1.0) + } + } + private func drawShapeLayer() { arrowLayer.frame = bounds - arrowLayer.strokeColor = color.cgColor + arrowLayer.strokeColor = arrowModel?.color.cgColor arrowLayer.fillColor = UIColor.clear.cgColor arrowLayer.path = arrowPath() arrowLayer.lineJoin = .miter arrowLayer.lineCap = .butt - arrowLayer.lineWidth = lineWidth + arrowLayer.lineWidth = arrowModel?.lineWidth ?? 1 } private func arrowPath() -> CGPath { - let length = max(bounds.size.height, bounds.size.width) - 1 -// let xInsetLeft = length * 0.25 -// let yInsetTop = length * 0.3 -// let innerWidth = length - (xInsetLeft + length * 0.25) // + Right X Inset -// let innerHeight = length - (yInsetTop + length * 0.35) // + Bottom Y Inset + let length = max(bounds.size.height, bounds.size.width) + let inset = (arrowModel?.lineWidth ?? 1) / 2 + let midLength = length / 2 - var startPoint = CGPoint(x: length * 0.5, y: 1) - let pivotPoint = CGPoint(x: length, y: length * 0.5) - var endPoint = CGPoint(x: length * 0.5, y: length) + var startPoint = CGPoint(x: midLength, y: inset) + let pivotPoint = CGPoint(x: length - inset, y: midLength) + var endPoint = CGPoint(x: midLength, y: length - inset) let bezierPath = UIBezierPath() bezierPath.move(to: startPoint) bezierPath.addLine(to: pivotPoint) bezierPath.addLine(to: endPoint) - startPoint = CGPoint(x: 1, y: length * 0.5) - endPoint = CGPoint(x: length, y: length * 0.5) + startPoint = CGPoint(x: inset, y: midLength) + endPoint = CGPoint(x: length - inset, y: midLength) bezierPath.move(to: startPoint) bezierPath.addLine(to: pivotPoint) return bezierPath.cgPath } - - //-------------------------------------------------- - // MARK: - MVMCoreMoleculeViewProtocol - //-------------------------------------------------- - - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - guard let model = model as? ArrowModel else { return } - - arrowLayer.transform = CATransform3DIdentity - - if let degrees = model.direction { - let radians = CGFloat(degrees * Double.pi / 180) - arrowLayer.transform = CATransform3DMakeRotation(-radians, 0.0, 0.0, 1.0) - } - } } diff --git a/MVMCoreUI/Atoms/Views/ArrowModel.swift b/MVMCoreUI/Atoms/Views/ArrowModel.swift index 62bf5c05..926a9ea7 100644 --- a/MVMCoreUI/Atoms/Views/ArrowModel.swift +++ b/MVMCoreUI/Atoms/Views/ArrowModel.swift @@ -17,7 +17,8 @@ open class ArrowModel: MoleculeModelProtocol { public var backgroundColor: Color? public var color: Color = Color(uiColor: .mvmBlack) - public var direction: Double? + public var degrees: Float = 0 + public var lineWidth: CGFloat = 1 //-------------------------------------------------- // MARK: - Keys @@ -27,8 +28,9 @@ open class ArrowModel: MoleculeModelProtocol { case moleculeName case backgroundColor case color - case direction + case degrees case size + case lineWidth } //-------------------------------------------------- @@ -37,20 +39,27 @@ open class ArrowModel: MoleculeModelProtocol { required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) { self.color = color } - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) - direction = try typeContainer.decodeIfPresent(Double.self, forKey: .direction) + if let degrees = try typeContainer.decodeIfPresent(Float.self, forKey: .degrees) { + self.degrees = degrees + } + + if let lineWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .lineWidth) { + self.lineWidth = lineWidth + } } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) - try container.encode(color, forKey: .color) - try container.encode(direction, forKey: .direction) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(color, forKey: .color) + try container.encode(degrees, forKey: .degrees) + try container.encodeIfPresent(backgroundColor, forKey: .lineWidth) } } From 78673b824ecc128b7ba89db36dbc87f0fc556048 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 11:46:17 -0500 Subject: [PATCH 14/30] removed test code --- MVMCoreUI/Atoms/Views/Arrow.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 7e1a510a..7ae112cc 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -26,9 +26,6 @@ open class Arrow: View { open override func setupView() { super.setupView() - heightAnchor.constraint(equalToConstant: 40).isActive = true - widthAnchor.constraint(equalToConstant: 40).isActive = true - drawShapeLayer() isOpaque = false layer.addSublayer(arrowLayer) From 1ee8c244cd15a3f704658b6eea17ea7a108e0837 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 11:57:10 -0500 Subject: [PATCH 15/30] merging --- MVMCoreUI/Atoms/Views/Arrow.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 7ae112cc..e59b4022 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -26,6 +26,9 @@ open class Arrow: View { open override func setupView() { super.setupView() + heightAnchor.constraint(equalToConstant: 12).isActive = true + widthAnchor.constraint(equalToConstant: 12).isActive = true + drawShapeLayer() isOpaque = false layer.addSublayer(arrowLayer) From c2baebe4831eb84e14dfde88b5572050aa85192a Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 12:00:45 -0500 Subject: [PATCH 16/30] removed testing code --- MVMCoreUI/Atoms/Views/Arrow.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index e59b4022..7ae112cc 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -26,9 +26,6 @@ open class Arrow: View { open override func setupView() { super.setupView() - heightAnchor.constraint(equalToConstant: 12).isActive = true - widthAnchor.constraint(equalToConstant: 12).isActive = true - drawShapeLayer() isOpaque = false layer.addSublayer(arrowLayer) From 6c92652f01cad6a7c618425f3da4b7072c294bff Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 12:31:47 -0500 Subject: [PATCH 17/30] moved files --- MVMCoreUI.xcodeproj/project.pbxproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index f33d39b2..5c92c180 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -94,10 +94,10 @@ 0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */; }; 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */; }; 0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; }; - 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; - 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; 0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BAE23FEF956004C5109 /* ExternalLink.swift */; }; 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; }; + 0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; }; + 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; }; 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; }; 31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; }; 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; }; @@ -435,10 +435,10 @@ 0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryField.swift; sourceTree = ""; }; 0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemDropdownEntryField.swift; sourceTree = ""; }; 0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; - 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; - 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = ""; }; 0AE98BAE23FEF956004C5109 /* ExternalLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLink.swift; sourceTree = ""; }; 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = ""; }; + 0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = ""; }; + 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.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 = ""; }; 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = ""; }; @@ -1341,8 +1341,8 @@ 0AA33B392398524F0067DD0F /* Toggle.swift */, D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */, 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */, - 0AE98BB423FF18D2004C5109 /* Arrow.swift */, 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */, + 0AE98BB423FF18D2004C5109 /* Arrow.swift */, ); path = Views; sourceTree = ""; From e7b7012708b9f69150938871606d82cd78172188 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Feb 2020 13:00:39 -0500 Subject: [PATCH 18/30] constraint convenience --- MVMCoreUI/Atoms/Views/Arrow.swift | 15 +++++++++++++++ MVMCoreUI/Atoms/Views/ArrowModel.swift | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atoms/Views/Arrow.swift index 7ae112cc..e932dd60 100644 --- a/MVMCoreUI/Atoms/Views/Arrow.swift +++ b/MVMCoreUI/Atoms/Views/Arrow.swift @@ -19,6 +19,21 @@ open class Arrow: View { return model as? ArrowModel } + //-------------------------------------------------- + // MARK: - Constraints + //-------------------------------------------------- + + public var heightConstraint: NSLayoutConstraint? + public var widthConstraint: NSLayoutConstraint? + + public func pinHeightAndWidth(constant: CGFloat = 12) { + + heightConstraint = heightAnchor.constraint(equalToConstant: constant) + widthConstraint = widthAnchor.constraint(equalToConstant: constant) + heightConstraint?.isActive = true + widthConstraint?.isActive = true + } + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- diff --git a/MVMCoreUI/Atoms/Views/ArrowModel.swift b/MVMCoreUI/Atoms/Views/ArrowModel.swift index 926a9ea7..2547f8d1 100644 --- a/MVMCoreUI/Atoms/Views/ArrowModel.swift +++ b/MVMCoreUI/Atoms/Views/ArrowModel.swift @@ -20,6 +20,9 @@ open class ArrowModel: MoleculeModelProtocol { public var degrees: Float = 0 public var lineWidth: CGFloat = 1 + public var height: CGFloat = 12 + public var width: CGFloat = 12 + //-------------------------------------------------- // MARK: - Keys //-------------------------------------------------- @@ -31,6 +34,8 @@ open class ArrowModel: MoleculeModelProtocol { case degrees case size case lineWidth + case height + case width } //-------------------------------------------------- @@ -52,6 +57,14 @@ open class ArrowModel: MoleculeModelProtocol { if let lineWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .lineWidth) { self.lineWidth = lineWidth } + + if let height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) { + self.lineWidth = height + } + + if let width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) { + self.width = width + } } public func encode(to encoder: Encoder) throws { @@ -61,5 +74,7 @@ open class ArrowModel: MoleculeModelProtocol { try container.encode(color, forKey: .color) try container.encode(degrees, forKey: .degrees) try container.encodeIfPresent(backgroundColor, forKey: .lineWidth) + try container.encode(width, forKey: .width) + try container.encode(height, forKey: .height) } } From 19ce1087eba605e327d26ae69d6268d9d773d197 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Fri, 28 Feb 2020 19:44:23 +0530 Subject: [PATCH 19/30] Removing percentage. --- .../ListLeftVariableRadioButtonAndPaymentMethod.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index 7667340c..f5865423 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -39,9 +39,9 @@ import UIKit eyebrowHeadlineBodyLink.setWithModel(model.eyebrowHeadlineBodyLink, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of labels - let stackModel = StackModel(molecules: [StackItemModel(percent:10,horizontalAlignment: .center), - StackItemModel(percent:10,horizontalAlignment: .fill), - StackItemModel(percent:80,horizontalAlignment: .leading)], + let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .leading)], axis: .horizontal) stack.model = stackModel stack.restack() From 36e34e1726316ce2e70bd696bcab34b458082bc5 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 10:30:57 -0500 Subject: [PATCH 20/30] fixes --- MVMCoreUI/Atoms/Views/Label/Label.swift | 4 +- MVMCoreUI/Atoms/Views/Label/LabelModel.swift | 4 +- MVMCoreUI/Atoms/Views/RadioButton.swift | 4 +- ...tVariableRadioButtonAndPaymentMethod.swift | 62 ++++++++++++------- ...ableRadioButtonAndPaymentMethodModel.swift | 12 +++- 5 files changed, 54 insertions(+), 32 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atoms/Views/Label/Label.swift index 0b1e896c..c7e72204 100644 --- a/MVMCoreUI/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label/Label.swift @@ -354,8 +354,8 @@ public typealias ActionBlock = () -> () } } - if let textColorHex = labelModel.textColor, !textColorHex.isEmpty { - textColor = UIColor.mfGet(forHex: textColorHex) + if let color = labelModel.textColor { + textColor = color.uiColor } if let attributes = labelModel.attributes, let labelText = text { diff --git a/MVMCoreUI/Atoms/Views/Label/LabelModel.swift b/MVMCoreUI/Atoms/Views/Label/LabelModel.swift index cb9cc0a9..3b5f2b66 100644 --- a/MVMCoreUI/Atoms/Views/Label/LabelModel.swift +++ b/MVMCoreUI/Atoms/Views/Label/LabelModel.swift @@ -18,7 +18,7 @@ import Foundation public var backgroundColor: Color? public var text: String public var accessibilityText: String? - public var textColor: String? + public var textColor: Color? public var fontStyle: String? public var fontName: String? public var fontSize: CGFloat? @@ -68,7 +68,7 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) text = try typeContainer.decode(String.self, forKey: .text) accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText) - textColor = try typeContainer.decodeIfPresent(String.self, forKey: .textColor) + textColor = try typeContainer.decodeIfPresent(Color.self, forKey: .textColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) fontStyle = try typeContainer.decodeIfPresent(String.self, forKey: .fontStyle) fontName = try typeContainer.decodeIfPresent(String.self, forKey: .fontName) diff --git a/MVMCoreUI/Atoms/Views/RadioButton.swift b/MVMCoreUI/Atoms/Views/RadioButton.swift index ac579b23..47eeb0ca 100644 --- a/MVMCoreUI/Atoms/Views/RadioButton.swift +++ b/MVMCoreUI/Atoms/Views/RadioButton.swift @@ -99,8 +99,8 @@ import UIKit accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint") } - public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) + public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) guard let model = model as? RadioButtonModel else { return } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift index f5865423..b4bb2fc3 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift @@ -12,42 +12,56 @@ import UIKit //----------------------------------------------------- // MARK: - Outlets - //------------------------------------------------------- + //----------------------------------------------------- let radioButton = RadioButton(frame: .zero) let leftImage = MFLoadImageView(pinnedEdges: .all) let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() - let stack = Stack(frame: .zero) + var stack: Stack + + //----------------------------------------------------- + // MARK: - Initializers + //----------------------------------------------------- + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)), + (view: leftImage, model: StackItemModel(horizontalAlignment: .fill)), + (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], + axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } //----------------------------------------------------- // MARK: - View Lifecycle - //------------------------------------------------------- + //----------------------------------------------------- override open func setupView() { super.setupView() - stack.stackItems = [StackItem(andContain: radioButton), - StackItem(andContain: leftImage), - StackItem(andContain: eyebrowHeadlineBodyLink)] addMolecule(stack) - } - //---------------------------------------------------- - // MARK: - Molecule - //----------------------------------------------------- - open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.setWithModel(model, delegateObject, additionalData) - guard let model = model as? ListLeftVariableRadioButtonAndPaymentMethodModel else { return} - radioButton.setWithModel(model.radioButton, delegateObject, additionalData) - leftImage.setWithModel(model.image, delegateObject, additionalData) - eyebrowHeadlineBodyLink.setWithModel(model.eyebrowHeadlineBodyLink, delegateObject, additionalData) - - // Create a stack model to use for the internal stack and set the alignment of labels - let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), - StackItemModel(horizontalAlignment: .fill), - StackItemModel(horizontalAlignment: .leading)], - axis: .horizontal) - stack.model = stackModel stack.restack() + eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA + eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) } - open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + open override func reset() { + super.reset() + eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA + eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(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? ListLeftVariableRadioButtonAndPaymentMethodModel else { return} + radioButton.set(with: model.radioButton, delegateObject, additionalData) + leftImage.set(with: model.image, delegateObject, additionalData) + eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 90 } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift index e7b41635..5ea28778 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift @@ -10,9 +10,9 @@ import Foundation public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol { public static var identifier: String = "listLVRBImg" - public var radioButton : RadioButtonModel + public var radioButton: RadioButtonModel public var image: ImageViewModel - public var eyebrowHeadlineBodyLink : EyebrowHeadlineBodyLinkModel + public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) { self.radioButton = radioButton @@ -21,6 +21,14 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo super.init() } + public override func setDefaults() { + super.setDefaults() + if image.width == nil, image.height == nil { + image.width = 32 + image.height = 32 + } + } + private enum CodingKeys: String, CodingKey { case moleculeName case radioButton From f779478cc58e5b3f7d8b61f87ba78c071d615a5d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 10:32:27 -0500 Subject: [PATCH 21/30] update --- MVMCoreUI.xcodeproj/project.pbxproj | 2 +- MVMCoreUI/Atoms/Views/RadioButtonModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index c4c93c6e..1b2654c3 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -1341,8 +1341,8 @@ 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */, 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */, 0A7BAFA2232BE63400FB8E22 /* CheckboxLabel.swift */, - 01004F2F22721C3800991ECC /* RadioButton.swift */, 011D95AE2407266E000E3791 /* RadioButtonModel.swift */, + 01004F2F22721C3800991ECC /* RadioButton.swift */, D28A838223CCBD3F00DFE4FC /* CircleProgressModel.swift */, 943784F3236B77BB006A1E82 /* GraphView.swift */, 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */, diff --git a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift index b061e35e..c8443691 100644 --- a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift +++ b/MVMCoreUI/Atoms/Views/RadioButtonModel.swift @@ -12,6 +12,6 @@ import Foundation public class RadioButtonModel: MoleculeModelProtocol { public static var identifier: String = "radioButton" public var backgroundColor: Color? - public var state: Bool? + public var state: Bool = false public var fieldKey: String? } From f230291e4787eb583f1fa5e8a0435e2b71943690 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 11:36:14 -0500 Subject: [PATCH 22/30] color --- MVMCoreUI/CustomPrimitives/Color.swift | 46 +++++++++++++++++--------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/MVMCoreUI/CustomPrimitives/Color.swift b/MVMCoreUI/CustomPrimitives/Color.swift index 165fa8ad..f06b337c 100644 --- a/MVMCoreUI/CustomPrimitives/Color.swift +++ b/MVMCoreUI/CustomPrimitives/Color.swift @@ -62,6 +62,14 @@ public final class Color: Codable { determineRGBA() } + public init?(colorString: String) throws { + let components = try Color.getColorComponents(for: colorString) + self.uiColor = components.color + hex = components.hex + name = components.name ?? "" + determineRGBA() + } + //-------------------------------------------------- // MARK: - Codable Initializers //-------------------------------------------------- @@ -69,21 +77,10 @@ public final class Color: Codable { required public init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() let colorString = try container.decode(String.self) - - if colorString.hasPrefix("#") { - hex = colorString.replacingOccurrences(of: "#", with: "") - } else { - guard let hex = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") } - self.hex = hex.replacingOccurrences(of: "#", with: "") - name = colorString - } - - if hex.count == 8 { - uiColor = UIColor.getColorWithTransparencyBy(hex: hex) - } else { - uiColor = UIColor.getColorBy(hex: hex) - } - + let components = try Color.getColorComponents(for: colorString) + self.uiColor = components.color + hex = components.hex + name = components.name ?? "" determineRGBA() } @@ -95,6 +92,25 @@ public final class Color: Codable { //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- + private static func getColorComponents(for colorString: String) throws -> (color: UIColor, hex: String, name: String?) { + var color: UIColor + var hex: String + var name: String? + if colorString.hasPrefix("#") { + hex = colorString.replacingOccurrences(of: "#", with: "") + } else { + guard let hexString = UIColor.names[colorString]?.hex else { throw ColorError.badName(reason: "Check the spelling of your color.") } + hex = hexString.replacingOccurrences(of: "#", with: "") + name = colorString + } + + if hex.count == 8 { + color = UIColor.getColorWithTransparencyBy(hex: hex) + } else { + color = UIColor.getColorBy(hex: hex) + } + return (color, hex, name) + } public func convertHexToFloat(start: String.Index, end: String.Index) -> CGFloat { From 527cdc684d7caaa5f74b3092c70062202ec3eb56 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 12:17:44 -0500 Subject: [PATCH 23/30] Small updates --- .../ListFourColumnDataUsageDivider.swift | 59 ++++++++++--------- .../ListFourColumnDataUsageDividerModel.swift | 3 +- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift index cd103787..35968599 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -11,50 +11,53 @@ import Foundation @objcMembers open class ListFourColumnDataUsageDivider: TableViewCell { // MARK: - MFViewProtocol - let label1 = Label.commonLabelB1(true) - let label2 = Label.commonLabelB1(true) - let label3 = Label.commonLabelB1(true) - let label4 = Label.commonLabelB1(true) - let stack = Stack(frame: .zero) + let label1 = Label.createLabelBoldBodySmall(true) + let label2 = Label.createLabelBoldBodySmall(true) + let label3 = Label.createLabelBoldBodySmall(true) + let label4 = Label.createLabelBoldBodySmall(true) + var stack: Stack + + // MARK: - Initializers + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + stack = Stack.createStack(with: [(view: label1, model: StackItemModel(percent: 19, horizontalAlignment: .leading)), + (view: label2, model: StackItemModel(percent: 44, horizontalAlignment: .leading)), + (view: label3, model: StackItemModel(percent: 17, horizontalAlignment: .leading)), + (view: label4, model: StackItemModel(percent: 20, horizontalAlignment: .leading))], + axis: .horizontal, spacing: 8) + 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() - stack.stackItems = [StackItem(andContain: label1), - StackItem(andContain: label2), - StackItem(andContain: label3), - StackItem(andContain: label4)] addMolecule(stack) + stack.restack() } // 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? ListFourColumnDataUsageDividerModel else { return } - label1.setWithModel(model.label1, delegateObject, additionalData) - label2.setWithModel(model.label2, delegateObject, additionalData) - label3.setWithModel(model.label3, delegateObject, additionalData) - label4.setWithModel(model.label4, delegateObject, additionalData) - //Create a stack model to use for the internal stack and set the alignment of labels - let stackModel = StackModel(molecules: [StackItemModel(percent: 15, horizontalAlignment: .leading), - StackItemModel(percent: 35, horizontalAlignment: .leading), - StackItemModel(percent: 30, horizontalAlignment: .trailing), - StackItemModel(percent: 20, horizontalAlignment: .trailing)], - axis: .horizontal) - stack.model = stackModel - stack.restack() + label1.set(with: model.label1, delegateObject, additionalData) + label2.set(with: model.label2, delegateObject, additionalData) + label3.set(with: model.label3, delegateObject, additionalData) + label4.set(with: model.label4, delegateObject, additionalData) } // MARK: - MVMCoreUIMoleculeViewProtocol open override func reset() { super.reset() - label1.styleB1(true) - label2.styleB1(true) - label3.styleB1(true) - label4.styleB1(true) + label1.styleBoldBodySmall(true) + label2.styleBoldBodySmall(true) + label3.styleBoldBodySmall(true) + label4.styleBoldBodySmall(true) } - open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { return 121 } } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift index 1277f4bb..f9ce88d8 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift @@ -21,10 +21,9 @@ public class ListFourColumnDataUsageDividerModel: ListItemModel, MoleculeModelPr self.label3 = label3 self.label4 = label4 super.init() - setDefaults() } - // Defaults to set + /// Defaults to set override public func setDefaults() { super.setDefaults() style = "tallDivider" From 27e1a97a80fa371a4a5ecbe0ad3c0151f441c76e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 12:21:13 -0500 Subject: [PATCH 24/30] order update --- .../OtherHandlers/MoleculeObjectMapping.swift | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 3d86b35a..34da2080 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -57,20 +57,13 @@ import Foundation // Horizontal Combination Molecules 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: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) - - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - // Vertical Combination Molecules MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) // Left Right Molecules MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) @@ -79,10 +72,6 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) // List items MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) @@ -107,6 +96,18 @@ import Foundation // Other Organisms MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) + // Designed List Items + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + + // Designed Section Dividers + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.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 cfd6cb13580436b8f6b6ef49895e8fef3b38c6a1 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 13:06:11 -0500 Subject: [PATCH 25/30] Teting --- MVMCoreUI.xcodeproj/project.pbxproj | 5 ++- ...ariableCheckboxAllTextAndLinksCustom.swift | 43 +++++++++++++++++++ ...VariableCheckboxAllTextAndLinksModel.swift | 4 +- .../OtherHandlers/MoleculeObjectMapping.swift | 3 ++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index b6167eb1..bc4c2af5 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -215,6 +215,7 @@ D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */; }; D28A839123CD4FD400DFE4FC /* CornerLabelsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */; }; D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */; }; + D28D6F71240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */; }; D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; }; D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -559,6 +560,7 @@ D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonViewModel.swift; sourceTree = ""; }; D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerLabelsModel.swift; sourceTree = ""; }; D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyCaretLinkImageModel.swift; sourceTree = ""; }; + D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksCustom.swift; sourceTree = ""; }; D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = ""; }; D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = ""; }; D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = ""; }; @@ -1064,6 +1066,7 @@ 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, + D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */, ); path = LeftVariable; sourceTree = ""; @@ -1072,7 +1075,6 @@ isa = PBXGroup; children = ( 525019E3240684E500EED91C /* FourColumn */, - 52267A0523FFE0A900906CBA /* OneColumn */, D22B38ED23F4E11100490EF6 /* ThreeColumn */, ); path = SectionDividers; @@ -1727,6 +1729,7 @@ D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, + D28D6F71240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift new file mode 100644 index 00000000..64394c1c --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift @@ -0,0 +1,43 @@ +// +// ListLeftVariableCheckboxAllTextAndLinksCustom.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 2/28/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class ListLeftVariableCheckboxAllTextAndLinksModelCustom: ListLeftVariableCheckboxAllTextAndLinksModel { + public override class var identifier: String { + return "listLVCBCustom" + } + + required public init(from decoder: Decoder) throws { + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + } +} + +@objcMembers open class ListLeftVariableCheckboxAllTextAndLinksCustom: ListLeftVariableCheckboxAllTextAndLinks { + // MARK:- MVMCoreUIMoleculeViewProtocol + open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.set(with: model, delegateObject, additionalData) + + // Update immediately. + eyebrowHeadlineBodyLink.stack.stackModel?.molecules[0].gone = !checkbox.isSelected + eyebrowHeadlineBodyLink.stack.restack() + + // Update on press. + checkbox.actionBlock = { [weak self] in + guard let self = self else { return } + print("hello") + self.eyebrowHeadlineBodyLink.stack.stackModel?.molecules[0].gone = !self.checkbox.isSelected + self.eyebrowHeadlineBodyLink.stack.restack() + delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) + } + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift index fec71c0b..4217b72a 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift @@ -9,7 +9,9 @@ import Foundation public class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "listLVCB" + public class var identifier: String { + return "listLVCB" + } public var checkbox: CheckboxModel public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 34da2080..68475878 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -103,6 +103,9 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinksCustom.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModelCustom.self) + // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) From 2d84b89af9552ef2aefaebbeadbb82a3efb2e455 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 28 Feb 2020 13:38:27 -0500 Subject: [PATCH 26/30] addressing issue where cell resizes but accessory does not follow. --- MVMCoreUI/BaseClasses/TableViewCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index b546ad2c..3154bbb9 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -96,8 +96,8 @@ import UIKit super.layoutSubviews() // Ensures accessory view aligns to the center y derived from the - if let center = heroAccessoryCenter { - accessoryView?.center.y = center.y + if let _ = heroAccessoryCenter { + alignAccessoryToHero() } } From 7345dce4b91f6557e2b6063c3c21d6fbf3658c7e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 13:46:33 -0500 Subject: [PATCH 27/30] Dropdown filter fix --- MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift b/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift index dd530605..f9b9d976 100644 --- a/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift +++ b/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift @@ -12,8 +12,6 @@ import UIKit //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - - var dropDownListItemModel: DropDownListItemModel? let dropDown = ItemDropdownEntryField() var delegateObject: MVMCoreUIDelegateObject? var previousIndex = NSNotFound @@ -31,7 +29,7 @@ import UIKit guard newValue != oldValue, let self = self, let index = self.dropDown.pickerData.firstIndex(of: newValue), - let dropListItemJSON = self.dropDownListItemModel.toJSON(), + let dropListItemJSON = (self.listItemModel as? DropDownListItemModel).toJSON(), let json2d = dropListItemJSON.optionalArrayForKey("molecules") as? [[[AnyHashable: Any]]] else { return } From 201fa2be81860038c36c4818292aadfd52d8243d Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 13:48:23 -0500 Subject: [PATCH 28/30] remove file testing --- MVMCoreUI.xcodeproj/project.pbxproj | 4 ---- MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift | 3 --- 2 files changed, 7 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index bc4c2af5..339735f3 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -215,7 +215,6 @@ D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */; }; D28A839123CD4FD400DFE4FC /* CornerLabelsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */; }; D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */; }; - D28D6F71240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */; }; D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; }; D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -560,7 +559,6 @@ D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonViewModel.swift; sourceTree = ""; }; D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerLabelsModel.swift; sourceTree = ""; }; D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyCaretLinkImageModel.swift; sourceTree = ""; }; - D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinksCustom.swift; sourceTree = ""; }; D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = ""; }; D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = ""; }; D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = ""; }; @@ -1066,7 +1064,6 @@ 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */, 8D24041423E7FC0B009E23BE /* ListLeftVariableIconWithRightCaretModel.swift */, 8D24041023E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift */, - D28D6F70240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift */, ); path = LeftVariable; sourceTree = ""; @@ -1729,7 +1726,6 @@ D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, - D28D6F71240988720046BD9D /* ListLeftVariableCheckboxAllTextAndLinksCustom.swift in Sources */, D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */, 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */, D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */, diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 68475878..34da2080 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -103,9 +103,6 @@ import Foundation MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinksCustom.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModelCustom.self) - // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) From 01a36a02457f2c3c3784e549856e7a32a703ac66 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 13:50:06 -0500 Subject: [PATCH 29/30] remove test file --- ...ariableCheckboxAllTextAndLinksCustom.swift | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift deleted file mode 100644 index 64394c1c..00000000 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksCustom.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// ListLeftVariableCheckboxAllTextAndLinksCustom.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 2/28/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public class ListLeftVariableCheckboxAllTextAndLinksModelCustom: ListLeftVariableCheckboxAllTextAndLinksModel { - public override class var identifier: String { - return "listLVCBCustom" - } - - required public init(from decoder: Decoder) throws { - try super.init(from: decoder) - } - - public override func encode(to encoder: Encoder) throws { - try super.encode(to: encoder) - } -} - -@objcMembers open class ListLeftVariableCheckboxAllTextAndLinksCustom: ListLeftVariableCheckboxAllTextAndLinks { - // MARK:- MVMCoreUIMoleculeViewProtocol - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - super.set(with: model, delegateObject, additionalData) - - // Update immediately. - eyebrowHeadlineBodyLink.stack.stackModel?.molecules[0].gone = !checkbox.isSelected - eyebrowHeadlineBodyLink.stack.restack() - - // Update on press. - checkbox.actionBlock = { [weak self] in - guard let self = self else { return } - print("hello") - self.eyebrowHeadlineBodyLink.stack.stackModel?.molecules[0].gone = !self.checkbox.isSelected - self.eyebrowHeadlineBodyLink.stack.restack() - delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) - } - } -} From 2e99d980e8721ff45329d00622d49264ea474d44 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 28 Feb 2020 14:08:38 -0500 Subject: [PATCH 30/30] open for mobile first --- .../Containers/Views/Container/ContainerModel.swift | 4 ++-- ...istLeftVariableCheckboxAllTextAndLinksModel.swift | 4 ++-- MVMCoreUI/Molecules/Items/ListItemModel.swift | 6 +++--- .../EyebrowHeadlineBodyLink.swift | 12 ++++++------ MVMCoreUI/Organisms/MoleculeStackView.swift | 2 +- MVMCoreUI/Organisms/Stack.swift | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Containers/Views/Container/ContainerModel.swift b/MVMCoreUI/Containers/Views/Container/ContainerModel.swift index a5e89adb..a18e8589 100644 --- a/MVMCoreUI/Containers/Views/Container/ContainerModel.swift +++ b/MVMCoreUI/Containers/Views/Container/ContainerModel.swift @@ -8,7 +8,7 @@ import Foundation -public class ContainerModel: ContainerModelProtocol, Codable { +open class ContainerModel: ContainerModelProtocol, Codable { public var horizontalAlignment: UIStackView.Alignment? public var verticalAlignment: UIStackView.Alignment? public var useHorizontalMargins: Bool? @@ -48,7 +48,7 @@ public class ContainerModel: ContainerModelProtocol, Codable { bottomMarginPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .bottomMarginPadding) } - public func encode(to encoder: Encoder) throws { + open func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: verticalAlignment), forKey: .verticalAlignment) try container.encodeIfPresent(ContainerHelper.getAlignmentString(for: horizontalAlignment), forKey: .horizontalAlignment) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift index 4217b72a..188af025 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift @@ -8,8 +8,8 @@ import Foundation -public class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { - public class var identifier: String { +open class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol { + open class var identifier: String { return "listLVCB" } public var checkbox: CheckboxModel diff --git a/MVMCoreUI/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Molecules/Items/ListItemModel.swift index 973a487a..4e0ccd35 100644 --- a/MVMCoreUI/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Molecules/Items/ListItemModel.swift @@ -9,7 +9,7 @@ import Foundation -@objcMembers public class ListItemModel: ContainerModel, ListItemModelProtocol { +@objcMembers open class ListItemModel: ContainerModel, ListItemModelProtocol { public var backgroundColor: Color? public var action: ActionModelProtocol? public var hideArrow: Bool? @@ -25,7 +25,7 @@ import Foundation } /// Defaults to set - public func setDefaults() { + open func setDefaults() { if useHorizontalMargins == nil { useHorizontalMargins = true } @@ -53,7 +53,7 @@ import Foundation setDefaults() } - public override func encode(to encoder: Encoder) throws { + open override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 58fa2d00..49b08b44 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -13,11 +13,11 @@ import UIKit // MARK: - Outlets //-------------------------------------------------- - let stack = Stack(frame: .zero) - let eyebrow = Label.commonLabelB3(true) - let headline = Label.commonLabelB1(true) - let body = Label.commonLabelB2(true) - let link = Link() + public let stack = Stack(frame: .zero) + public let eyebrow = Label.commonLabelB3(true) + public let headline = Label.commonLabelB1(true) + public let body = Label.commonLabelB2(true) + public let link = Link() var casteModel: EyebrowHeadlineBodyLinkModel? { get { return model as? EyebrowHeadlineBodyLinkModel } @@ -72,7 +72,7 @@ import UIKit stack.restack() } - public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 65 } } diff --git a/MVMCoreUI/Organisms/MoleculeStackView.swift b/MVMCoreUI/Organisms/MoleculeStackView.swift index 653e2ebf..12d79dcd 100644 --- a/MVMCoreUI/Organisms/MoleculeStackView.swift +++ b/MVMCoreUI/Organisms/MoleculeStackView.swift @@ -9,7 +9,7 @@ import UIKit open class MoleculeStackView: Stack { - override var stackModel: MoleculeStackModel? { + open override var stackModel: MoleculeStackModel? { get { return model as? MoleculeStackModel } } diff --git a/MVMCoreUI/Organisms/Stack.swift b/MVMCoreUI/Organisms/Stack.swift index b0841e7c..696964f1 100644 --- a/MVMCoreUI/Organisms/Stack.swift +++ b/MVMCoreUI/Organisms/Stack.swift @@ -14,11 +14,11 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto // MARK: - Properties //-------------------------------------------------- - var contentView: UIView = MVMCoreUICommonViewsUtility.commonView() - var stackModel: T? { + open var contentView: UIView = MVMCoreUICommonViewsUtility.commonView() + open var stackModel: T? { get { return model as? T } } - var stackItems: [UIView] = [] + open var stackItems: [UIView] = [] //-------------------------------------------------- // MARK: - Helpers