Folder structure changes and conforming to headerView and headermodel

This commit is contained in:
Lekshmi S 2020-03-18 10:04:37 +05:30
parent 9187e0adf3
commit f58b57e145
4 changed files with 18 additions and 27 deletions

View File

@ -175,10 +175,10 @@
AA119DEA240FB430005F98FD /* HeadersH1ButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA119DE9240FB430005F98FD /* HeadersH1ButtonModel.swift */; };
AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */; };
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */; };
BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; };
BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.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 */; };
BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.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 */; };
@ -554,10 +554,10 @@
AA119DE9240FB430005F98FD /* HeadersH1ButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH1ButtonModel.swift; sourceTree = "<group>"; };
AA11A41E23F15D3100D7962F /* ListRightVariablePayments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePayments.swift; sourceTree = "<group>"; };
AA11A42023F15D7000D7962F /* ListRightVariablePaymentsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRightVariablePaymentsModel.swift; sourceTree = "<group>"; };
BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = "<group>"; };
BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = "<group>"; };
AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyText.swift; sourceTree = "<group>"; };
AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = "<group>"; };
BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = "<group>"; };
BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = "<group>"; };
C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; };
C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; };
@ -898,6 +898,8 @@
children = (
AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */,
AAA74A162410C04600080241 /* HeadersH2NoButtonsBodyText.swift */,
AA119DE7240FB41C005F98FD /* HeadersH1Button.swift */,
AA119DE9240FB430005F98FD /* HeadersH1ButtonModel.swift */,
);
path = Headers;
sourceTree = "<group>";
@ -1159,8 +1161,6 @@
525239C32407FFCC00454969 /* LockUps */,
D22B38EC23F4E10700490EF6 /* SectionDividers */,
D22B38EA23F4E08B00490EF6 /* List */,
AA119DE7240FB41C005F98FD /* HeadersH1Button.swift */,
AA119DE9240FB430005F98FD /* HeadersH1ButtonModel.swift */,
);
path = DesignedComponents;
sourceTree = "<group>";

View File

@ -8,14 +8,13 @@
import Foundation
@objcMembers open class HeadersH1Button: View {
@objcMembers open class HeadersH1Button: HeaderView {
//--------------------------------------------------
// MARK: - Outlets
//--------------------------------------------------
let headlineBody = HeadlineBody(frame: .zero)
let button = PrimaryButton.button()
var stack = Stack<StackModel>(frame: .zero)
var spacingBetwenHeadlineBodyAndButton: CGFloat = 72.0
//-------------------------------------------------------
// MARK: - View Lifecycle
@ -23,14 +22,10 @@ import Foundation
open override func setupView() {
super.setupView()
stack = Stack<StackModel>.createStack(with: [(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)),
(view: button, model: StackItemModel(spacing: spacingBetwenHeadlineBodyAndButton, horizontalAlignment: .leading))], axis: .vertical)
addSubview(stack)
NSLayoutConstraint.constraintPinSubview(toSuperview: stack)
}
open override func updateView(_ size: CGFloat) {
super.updateView(size)
stack.updateView(size)
(view: button, model: StackItemModel(spacing: 72, horizontalAlignment: .leading))], axis: .vertical)
headlineBody.styleLandingPageHeader()
addMolecule(stack)
stack.restack()
}
//----------------------------------------------------
@ -41,7 +36,6 @@ import Foundation
guard let model = model as? HeadersH1ButtonModel else { return }
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
button.set(with: model.button, delegateObject, additionalData)
stack.restack()
}
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {

View File

@ -8,22 +8,21 @@
import Foundation
public class HeadersH1ButtonModel: MoleculeModelProtocol {
public class HeadersH1ButtonModel: HeaderModel, MoleculeModelProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public static var identifier: String = "headerH1Btn"
public var backgroundColor: Color?
public var headlineBody: HeadlineBodyModel
public var button: ButtonModel
//--------------------------------------------------
// MARK: - Initializer
//--------------------------------------------------
public init(headlineBody: HeadlineBodyModel, button: ButtonModel) {
self.headlineBody = headlineBody
self.button = button
super.init()
}
//--------------------------------------------------
@ -31,7 +30,6 @@ public class HeadersH1ButtonModel: MoleculeModelProtocol {
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case headlineBody
case button
}
@ -41,15 +39,15 @@ public class HeadersH1ButtonModel: 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)
button = try typeContainer.decode(ButtonModel.self, forKey: .button)
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(button, forKey: .button)
}

View File

@ -111,8 +111,6 @@ import Foundation
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH1Button.self, viewModelClass: HeadersH1ButtonModel.self)
// Designed Section Dividers
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self)
@ -120,6 +118,7 @@ import Foundation
// Designed Headers
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH1Button.self, viewModelClass: HeadersH1ButtonModel.self)
// TODO: Need model
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString)