From 14bedf6f315f936cf9ed73b258a31aaf656b4430 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 10 Mar 2020 12:12:45 +0530 Subject: [PATCH 1/8] 19216(Headers - H2 - Buttons) initial commit Created model and molecule class. --- MVMCoreUI.xcodeproj/project.pbxproj | 8 +++ .../DesignedComponents/HeadersH2Buttons.swift | 57 +++++++++++++++++++ .../HeadersH2ButtonsModel.swift | 56 ++++++++++++++++++ .../OtherHandlers/MoleculeObjectMapping.swift | 1 + 4 files changed, 122 insertions(+) create mode 100644 MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift create mode 100644 MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 8de69762..0dae59fe 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -154,6 +154,8 @@ 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; + AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */; }; + AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.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 */; }; @@ -505,6 +507,8 @@ 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; + AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = ""; }; + AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2ButtonsModel.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 = ""; }; @@ -1054,6 +1058,8 @@ 525239C32407FFCC00454969 /* LockUps */, D22B38EC23F4E10700490EF6 /* SectionDividers */, D22B38EA23F4E08B00490EF6 /* List */, + AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */, + AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */, ); path = DesignedComponents; sourceTree = ""; @@ -1876,6 +1882,7 @@ D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */, 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, + AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */, 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, @@ -1915,6 +1922,7 @@ D29DF28C21E7AC2B003B2FB9 /* ViewConstrainingView.m in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, + AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */, 017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, 012CA99A2384A687003F810F /* MFTextField+ModelExtension.swift in Sources */, diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift b/MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift new file mode 100644 index 00000000..00521edf --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift @@ -0,0 +1,57 @@ +// +// HeadersH2Buttons.swift +// MVMCoreUI +// +// Created by Lekshmi S on 10/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class HeadersH2Buttons: View { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + let headlineBody = HeadlineBody(frame: .zero) + let buttons = TwoButtonView(frame: .zero) + var stack = Stack(frame: .zero) + var spacingBetwenHeadlineBodyAndButton: CGFloat = 24.0 + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), + (view: buttons, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical) + headlineBody.stylePageHeader() + addSubview(stack) + NSLayoutConstraint.constraintPinSubview(toSuperview: stack) + } + + open override func updateView(_ size: CGFloat) { + super.updateView(size) + stack.updateView(size) + } + + //---------------------------------------------------- + // 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? HeadersH2ButtonsModel else { return } + headlineBody.set(with: model.headlineBody, delegateObject, additionalData) + buttons.set(with: model.buttons, delegateObject, additionalData) + stack.restack() + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headlineBody.stylePageHeader() + buttons.reset() + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift new file mode 100644 index 00000000..fb03fefc --- /dev/null +++ b/MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift @@ -0,0 +1,56 @@ +// +// HeadersH2ButtonsModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 10/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadersH2ButtonsModel: MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + + public static var identifier: String = "headerH2Btns" + public var backgroundColor: Color? + public var headlineBody: HeadlineBodyModel + public var buttons: TwoButtonViewModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(headlineBody: HeadlineBodyModel, buttons: TwoButtonViewModel) { + self.headlineBody = headlineBody + self.buttons = buttons + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case headlineBody + case buttons + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(moleculeName, forKey: .moleculeName) + try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) + try container.encode(headlineBody, forKey: .headlineBody) + try container.encode(buttons, forKey: .buttons) + } +} diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift index 003b5d03..7aad3786 100644 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift @@ -109,6 +109,7 @@ import Foundation // Designed Section Dividers MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) // TODO: Need model MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(DigitEntryField.self, forKey: "digitTextField" as NSString) From d161fbf9fb5f027d4c48e5afb439a31588daa943 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 19 Mar 2020 11:26:25 +0530 Subject: [PATCH 2/8] Folder structure changes and conforming to headerView and headermodel. --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++++++------ .../{ => Headers}/HeadersH2Buttons.swift | 15 ++++----------- .../{ => Headers}/HeadersH2ButtonsModel.swift | 17 +++++++++++------ 3 files changed, 21 insertions(+), 23 deletions(-) rename MVMCoreUI/Molecules/DesignedComponents/{ => Headers}/HeadersH2Buttons.swift (80%) rename MVMCoreUI/Molecules/DesignedComponents/{ => Headers}/HeadersH2ButtonsModel.swift (80%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 9da3f293..afc44643 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -175,6 +175,8 @@ 94FB966323D797DA003D482B /* MFTextButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FB966123D797DA003D482B /* MFTextButton.m */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; + AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */; }; + AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */; }; AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */; }; AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; @@ -183,8 +185,6 @@ BB6C6AC1242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */; }; BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */; }; BB6C6AC924225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */; }; - AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */; }; - AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.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 */; }; @@ -561,6 +561,8 @@ 94FB966123D797DA003D482B /* MFTextButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFTextButton.m; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; + AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = ""; }; + AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2ButtonsModel.swift; sourceTree = ""; }; AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyText.swift; sourceTree = ""; }; AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; @@ -569,8 +571,6 @@ BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListOneColumnTextWithWhitespaceDividerTall.swift; path = MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = SOURCE_ROOT; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; - AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = ""; }; - AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2ButtonsModel.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 = ""; }; @@ -912,6 +912,8 @@ children = ( AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */, AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */, + AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */, + AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */, ); path = Headers; sourceTree = ""; @@ -1187,8 +1189,6 @@ 525239C32407FFCC00454969 /* LockUps */, D22B38EC23F4E10700490EF6 /* SectionDividers */, D22B38EA23F4E08B00490EF6 /* List */, - AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */, - AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */, ); path = DesignedComponents; sourceTree = ""; diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift b/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift similarity index 80% rename from MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift rename to MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift index 00521edf..0f359d52 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2Buttons.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift @@ -8,14 +8,13 @@ import Foundation -@objcMembers open class HeadersH2Buttons: View { +@objcMembers open class HeadersH2Buttons: HeaderView { //-------------------------------------------------- // MARK: - Outlets //-------------------------------------------------- let headlineBody = HeadlineBody(frame: .zero) let buttons = TwoButtonView(frame: .zero) var stack = Stack(frame: .zero) - var spacingBetwenHeadlineBodyAndButton: CGFloat = 24.0 //------------------------------------------------------- // MARK: - View Lifecycle @@ -23,15 +22,10 @@ import Foundation open override func setupView() { super.setupView() stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), - (view: buttons, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical) + (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) headlineBody.stylePageHeader() - addSubview(stack) - NSLayoutConstraint.constraintPinSubview(toSuperview: stack) - } - - open override func updateView(_ size: CGFloat) { - super.updateView(size) - stack.updateView(size) + addMolecule(stack) + stack.restack() } //---------------------------------------------------- @@ -42,7 +36,6 @@ import Foundation guard let model = model as? HeadersH2ButtonsModel else { return } headlineBody.set(with: model.headlineBody, delegateObject, additionalData) buttons.set(with: model.buttons, delegateObject, additionalData) - stack.restack() } open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift similarity index 80% rename from MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift rename to MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift index fb03fefc..5bc285ad 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/HeadersH2ButtonsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift @@ -8,13 +8,12 @@ import Foundation -public class HeadersH2ButtonsModel: MoleculeModelProtocol { +public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- public static var identifier: String = "headerH2Btns" - public var backgroundColor: Color? public var headlineBody: HeadlineBodyModel public var buttons: TwoButtonViewModel @@ -24,6 +23,13 @@ public class HeadersH2ButtonsModel: MoleculeModelProtocol { public init(headlineBody: HeadlineBodyModel, buttons: TwoButtonViewModel) { self.headlineBody = headlineBody self.buttons = buttons + super.init() + } + + public override func setDefaults() { + super.setDefaults() + topMarginPadding = PaddingDefaultVerticalSpacing3 + bottomMarginPadding = PaddingDefaultVerticalSpacing3 } //-------------------------------------------------- @@ -31,7 +37,6 @@ public class HeadersH2ButtonsModel: MoleculeModelProtocol { //-------------------------------------------------- private enum CodingKeys: String, CodingKey { case moleculeName - case backgroundColor case headlineBody case buttons } @@ -41,15 +46,15 @@ public class HeadersH2ButtonsModel: MoleculeModelProtocol { //-------------------------------------------------- required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons) + try super.init(from: decoder) } - public func encode(to encoder: Encoder) throws { + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(moleculeName, forKey: .moleculeName) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encode(headlineBody, forKey: .headlineBody) try container.encode(buttons, forKey: .buttons) } From 21af3227c929e049560ed3f2464804190324b289 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Wed, 15 Apr 2020 19:32:34 +0530 Subject: [PATCH 3/8] Restructured folder after merge from develop. --- MVMCoreUI.xcodeproj/project.pbxproj | 16 ++++++++-------- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../Headers/HeadersH2Buttons.swift | 0 .../Headers/HeadersH2ButtonsModel.swift | 0 4 files changed, 9 insertions(+), 8 deletions(-) rename MVMCoreUI/Atomic/Molecules/{HorizontalCombinationViews => }/DesignedComponents/Headers/HeadersH2Buttons.swift (100%) rename MVMCoreUI/Atomic/Molecules/{HorizontalCombinationViews => }/DesignedComponents/Headers/HeadersH2ButtonsModel.swift (100%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index e681e1e9..1c0a4c00 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -184,14 +184,14 @@ 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 */; }; + AA104B1A24474A66004D2810 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */; }; + AA104B1C24474A76004D2810 /* HeadersH2ButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */; }; AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; }; AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; }; AA1EC59724373985003D6F50 /* ListThreeColumnSpeedTestDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1EC59624373985003D6F50 /* ListThreeColumnSpeedTestDividerModel.swift */; }; AA1EC59924373994003D6F50 /* ListThreeColumnSpeedTestDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1EC59824373994003D6F50 /* ListThreeColumnSpeedTestDivider.swift */; }; AA56A20F243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */; }; AA56A211243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */; }; - AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */; }; - AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */; }; AAA74A172410C04600080241 /* HeadersH2NoButtonsBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */; }; AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */; }; BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; @@ -612,14 +612,14 @@ 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 = ""; }; + AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = ""; }; + AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2ButtonsModel.swift; sourceTree = ""; }; AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = ""; }; AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = ""; }; AA1EC59624373985003D6F50 /* ListThreeColumnSpeedTestDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnSpeedTestDividerModel.swift; sourceTree = ""; }; AA1EC59824373994003D6F50 /* ListThreeColumnSpeedTestDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListThreeColumnSpeedTestDivider.swift; sourceTree = ""; }; AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDividerModel.swift; sourceTree = ""; }; AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTwoColumnSubsectionDivider.swift; sourceTree = ""; }; - AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2Buttons.swift; sourceTree = ""; }; - AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2ButtonsModel.swift; sourceTree = ""; }; AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyText.swift; sourceTree = ""; }; AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = ""; }; @@ -998,8 +998,8 @@ children = ( AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */, AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */, - AA2D8156241766AC00857570 /* HeadersH2Buttons.swift */, - AA2D8158241766CC00857570 /* HeadersH2ButtonsModel.swift */, + AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, + AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, ); path = Headers; sourceTree = ""; @@ -2240,7 +2240,6 @@ D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */, 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */, 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, - AA2D8157241766AC00857570 /* HeadersH2Buttons.swift in Sources */, 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, @@ -2297,7 +2296,6 @@ 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, - AA2D8159241766CC00857570 /* HeadersH2ButtonsModel.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, 01EB3684236097C0006832FA /* MoleculeModelProtocol.swift in Sources */, D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */, @@ -2354,10 +2352,12 @@ DBC4391B224421A0001AB423 /* CaretLink.swift in Sources */, D264FA90243BCE6800D98315 /* ThreeLayerCollectionViewController.swift in Sources */, 0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */, + AA104B1C24474A76004D2810 /* HeadersH2ButtonsModel.swift in Sources */, 0A6BF4722360C56C0028F841 /* BaseDropdownEntryField.swift in Sources */, BB6C6AC824225290005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift in Sources */, 0A41BA6E2344FCD400D4C0BC /* CATransaction+Extension.swift in Sources */, D21B7F73243BAC6800051ABF /* CollectionItemModelProtocol.swift in Sources */, + AA104B1A24474A66004D2810 /* HeadersH2Buttons.swift in Sources */, C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */, D29DF13221E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.m in Sources */, D29DF29C21E7ADB9003B2FB9 /* MFProgrammaticTableViewController.m in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index ab0d5b43..eaddc237 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -163,6 +163,7 @@ import Foundation // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) // TODO: Need View try? ModelRegistry.register(TabsModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/DesignedComponents/Headers/HeadersH2Buttons.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift similarity index 100% rename from MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/DesignedComponents/Headers/HeadersH2Buttons.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/DesignedComponents/Headers/HeadersH2ButtonsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift similarity index 100% rename from MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/DesignedComponents/Headers/HeadersH2ButtonsModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift From 372d5c9098971398632a6f102cb5d9ca42aabe8c Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 28 Apr 2020 14:07:18 +0530 Subject: [PATCH 4/8] Code cleanup --- .../DesignedComponents/Headers/HeadersH2Buttons.swift | 9 ++++----- .../Headers/HeadersH2ButtonsModel.swift | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift index 0f359d52..81da0471 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift @@ -12,17 +12,16 @@ import Foundation //-------------------------------------------------- // MARK: - Outlets //-------------------------------------------------- - let headlineBody = HeadlineBody(frame: .zero) - let buttons = TwoButtonView(frame: .zero) - var stack = Stack(frame: .zero) + public let headlineBody = HeadlineBody(frame: .zero) + public let buttons = TwoButtonView(frame: .zero) + public var stack = Stack(frame: .zero) //------------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- open override func setupView() { super.setupView() - stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), - (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) + stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) headlineBody.stylePageHeader() addMolecule(stack) stack.restack() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift index 5bc285ad..afc57f2e 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2ButtonsModel.swift @@ -12,7 +12,6 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public static var identifier: String = "headerH2Btns" public var headlineBody: HeadlineBodyModel public var buttons: TwoButtonViewModel @@ -28,8 +27,8 @@ public class HeadersH2ButtonsModel: HeaderModel, MoleculeModelProtocol { public override func setDefaults() { super.setDefaults() - topMarginPadding = PaddingDefaultVerticalSpacing3 - bottomMarginPadding = PaddingDefaultVerticalSpacing3 + topPadding = PaddingDefaultVerticalSpacing3 + bottomPadding = PaddingDefaultVerticalSpacing3 } //-------------------------------------------------- From 4346abe3785132a0ba67ad4588010ca375e81eed Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Thu, 7 May 2020 16:03:28 +0530 Subject: [PATCH 5/8] Minor change. --- .../Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift index 81da0471..3775408c 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift @@ -21,7 +21,7 @@ import Foundation //------------------------------------------------------- open override func setupView() { super.setupView() - stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) + stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) headlineBody.stylePageHeader() addMolecule(stack) stack.restack() From a2a1f9563109ffa544ab741db311f1ac8d4ee9db Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 12 May 2020 18:25:43 +0530 Subject: [PATCH 6/8] Code changes as per review comments. --- MVMCoreUI.xcodeproj/project.pbxproj | 2 +- .../DesignedComponents/Headers/HeadersH2Buttons.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 6d308156..1b66b097 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -959,8 +959,8 @@ AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */, AA26850D244840C300CE34CC /* HeadersH2TinyButtonModel.swift */, AA26850B244840AE00CE34CC /* HeadersH2TinyButton.swift */, - AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, AA104B1B24474A76004D2810 /* HeadersH2ButtonsModel.swift */, + AA104B1924474A66004D2810 /* HeadersH2Buttons.swift */, ); path = Headers; sourceTree = ""; diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift index 3775408c..b647d32f 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift @@ -21,7 +21,8 @@ import Foundation //------------------------------------------------------- open override func setupView() { super.setupView() - stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .leading))], axis: .vertical) + stack.model = StackModel(molecules: [], axis: .vertical, spacing: 0) + stack.set(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .fill))]) headlineBody.stylePageHeader() addMolecule(stack) stack.restack() @@ -44,6 +45,5 @@ import Foundation open override func reset() { super.reset() headlineBody.stylePageHeader() - buttons.reset() } } From 7729529a9ca545634900f9637519b58079749ccd Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 12 May 2020 13:03:17 -0400 Subject: [PATCH 7/8] efficiency changes --- .../Headers/HeadersH2Buttons.swift | 16 +++++++++++++--- .../Headers/HeadersH2TinyButton.swift | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift index b647d32f..57e62d24 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2Buttons.swift @@ -14,15 +14,25 @@ import Foundation //-------------------------------------------------- public let headlineBody = HeadlineBody(frame: .zero) public let buttons = TwoButtonView(frame: .zero) - public var stack = Stack(frame: .zero) + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [headlineBody, buttons], spacing: PaddingDefaultVerticalSpacing3) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } //------------------------------------------------------- // MARK: - View Lifecycle //------------------------------------------------------- open override func setupView() { super.setupView() - stack.model = StackModel(molecules: [], axis: .vertical, spacing: 0) - stack.set(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: buttons, model: StackItemModel(spacing: PaddingDefaultVerticalSpacing3, horizontalAlignment: .fill))]) headlineBody.stylePageHeader() addMolecule(stack) stack.restack() diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2TinyButton.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2TinyButton.swift index 0991eec6..788a6a89 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2TinyButton.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2TinyButton.swift @@ -14,7 +14,19 @@ import Foundation //-------------------------------------------------- public let headlineBody = HeadlineBody(frame: .zero) public let button = PillButton(frame: .zero) - public var stack = Stack(frame: .zero) + public let stack: Stack + + //------------------------------------------------------- + // MARK: - Initializers + //------------------------------------------------------- + public override init(frame: CGRect) { + stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical) + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } //------------------------------------------------------ // MARK: - Constants @@ -26,7 +38,6 @@ import Foundation //------------------------------------------------------- open override func setupView() { super.setupView() - stack = Stack.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .fill)), (view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical) headlineBody.stylePageHeader() addMolecule(stack) stack.restack() From eb6035b378f39b284fdf0657440975d7df5970ee Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Tue, 12 May 2020 16:47:02 -0400 Subject: [PATCH 8/8] delegate fix --- MVMCoreUI/BaseControllers/ViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 0872b0e6..a10e0767 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -17,7 +17,7 @@ import UIKit public var manager: (UIViewController & MVMCoreViewManagerProtocol)? /// A temporary iVar backer for delegateObject() until we change the protocol - public let delegateObjectIVar: MVMCoreUIDelegateObject = { + public lazy var delegateObjectIVar: MVMCoreUIDelegateObject = { return MVMCoreUIDelegateObject.create(withDelegateForAll: self) }()