diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index d483d10c..6c80ccd2 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -191,6 +191,8 @@ AA0A257A24766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA0A257924766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift */; }; AA104AC724472DB0004D2810 /* HeadersH1Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AC624472DB0004D2810 /* HeadersH1Button.swift */; }; AA104AC924472DC7004D2810 /* HeadersH1ButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */; }; + AA104ADA244734DB004D2810 /* HeadersH1LandingPageHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */; }; + AA104ADC244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */; }; 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 */; }; @@ -643,6 +645,8 @@ AA0A257924766CA200862F64 /* ListLeftVariableIconWithRightCaretBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableIconWithRightCaretBodyText.swift; sourceTree = ""; }; AA104AC624472DB0004D2810 /* HeadersH1Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1Button.swift; sourceTree = ""; }; AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1ButtonModel.swift; sourceTree = ""; }; + AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1LandingPageHeader.swift; sourceTree = ""; }; + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1LandingPageHeaderModel.swift; 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 = ""; }; @@ -1498,6 +1502,8 @@ children = ( AA104AC824472DC7004D2810 /* HeadersH1ButtonModel.swift */, AA104AC624472DB0004D2810 /* HeadersH1Button.swift */, + AA104ADB244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift */, + AA104AD9244734DB004D2810 /* HeadersH1LandingPageHeader.swift */, ); path = H1; sourceTree = ""; @@ -2248,6 +2254,7 @@ D2A92886241ACD99004E01C6 /* ProgrammaticTableViewController.swift in Sources */, BBAA4F05243D8E3B005AAD5F /* RadioBoxesModel.swift in Sources */, 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, + AA104ADA244734DB004D2810 /* HeadersH1LandingPageHeader.swift in Sources */, 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, 94F6516D2437954100631BF9 /* Tabs.swift in Sources */, @@ -2359,6 +2366,7 @@ 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */, + AA104ADC244734EA004D2810 /* HeadersH1LandingPageHeaderModel.swift in Sources */, BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index cb8cb91d..c6bb77bb 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -205,6 +205,7 @@ import Foundation // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH1Button.self, viewModelClass: HeadersH1ButtonModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH1LandingPageHeader.self, viewModelClass: HeadersH1LandingPageHeaderModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2TinyButton.self, viewModelClass: HeadersH2TinyButtonModel.self) MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2Buttons.self, viewModelClass: HeadersH2ButtonsModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeader.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeader.swift new file mode 100644 index 00000000..c78ada3f --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeader.swift @@ -0,0 +1,71 @@ +// +// HeadersH1LandingPageHeader.swift +// MVMCoreUI +// +// Created by Lekshmi S on 09/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers open class HeadersH1LandingPageHeader: HeaderView { + //-------------------------------------------------- + // MARK: - Outlets + //-------------------------------------------------- + public let headline = Label(fontStyle: .Title2XLarge) + public let headline2 = Label(fontStyle: .Title2XLarge) + public let subHeadline = Label(fontStyle: .BoldBodySmall) + public let body = Label(fontStyle: .RegularBodySmall) + public let link = Link() + public let buttons = TwoButtonView(frame: .zero) + public var stack: Stack! + + //-------------------------------------------------- + // MARK: - Constants + //-------------------------------------------------- + let spacingBetweenHeadlineHeadline2: CGFloat = 16.0 + let spacingBetweenHeadline2subHeadline: CGFloat = 32.0 + let spacingBetweenSubHeadlineBodyLink: CGFloat = 8.0 + let spacingBetweenLinkButtons: CGFloat = 128.0 + + //------------------------------------------------------- + // MARK: - View Lifecycle + //------------------------------------------------------- + open override func setupView() { + super.setupView() + stack = Stack.createStack(with: [(view: headline, model: StackItemModel()), + (view: headline2, model: StackItemModel(spacing: spacingBetweenHeadlineHeadline2)), + (view: subHeadline, model: StackItemModel(spacing: spacingBetweenHeadline2subHeadline)), + (view: body, model: StackItemModel(spacing: spacingBetweenSubHeadlineBodyLink)), + (view: link, model: StackItemModel(spacing: spacingBetweenSubHeadlineBodyLink, horizontalAlignment: .leading)), + (view: buttons, model: StackItemModel(spacing: spacingBetweenLinkButtons))]) + addMolecule(stack) + stack.restack() + } + + //---------------------------------------------------- + // 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? HeadersH1LandingPageHeaderModel else { return } + headline.set(with: model.headline, delegateObject, additionalData) + headline2.set(with: model.headline2, delegateObject, additionalData) + subHeadline.set(with: model.subHeadline, delegateObject, additionalData) + body.set(with: model.body, delegateObject, additionalData) + link.set(with: model.link, delegateObject, additionalData) + buttons.set(with: model.buttons, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 121 + } + + open override func reset() { + super.reset() + headline.setFontStyle(.Title2XLarge) + headline2.setFontStyle(.Title2XLarge) + subHeadline.setFontStyle(.BoldBodySmall) + body.setFontStyle(.RegularBodySmall) + } +} diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeaderModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeaderModel.swift new file mode 100644 index 00000000..d7603886 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/H1/HeadersH1LandingPageHeaderModel.swift @@ -0,0 +1,74 @@ +// +// HeadersH1LandingPageHeaderModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 09/03/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadersH1LandingPageHeaderModel: HeaderModel, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "headerH1Landing" + public var headline: LabelModel + public var headline2: LabelModel + public var subHeadline: LabelModel + public var body: LabelModel + public var link: LinkModel + public var buttons: TwoButtonViewModel + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(headline: LabelModel, headline2: LabelModel, subHeadline: LabelModel, body: LabelModel, link: LinkModel, buttons: TwoButtonViewModel) { + self.headline = headline + self.headline2 = headline2 + self.subHeadline = subHeadline + self.body = body + self.link = link + self.buttons = buttons + super.init() + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { + case moleculeName + case headline + case headline2 + case subHeadline + case body + case link + case buttons + } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + headline = try typeContainer.decode(LabelModel.self, forKey: .headline) + headline2 = try typeContainer.decode(LabelModel.self, forKey: .headline2) + subHeadline = try typeContainer.decode(LabelModel.self, forKey: .subHeadline) + body = try typeContainer.decode(LabelModel.self, forKey: .body) + link = try typeContainer.decode(LinkModel.self, forKey: .link) + buttons = try typeContainer.decode(TwoButtonViewModel.self, forKey: .buttons) + 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(headline, forKey: .headline) + try container.encode(headline2, forKey: .headline2) + try container.encode(subHeadline, forKey: .subHeadline) + try container.encode(body, forKey: .body) + try container.encode(link, forKey: .link) + try container.encode(buttons, forKey: .buttons) + } +}