From 124a46f8d6fc396c36cfa1473e2ca2d999b19109 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 21 Apr 2020 13:53:10 +0530 Subject: [PATCH 1/6] 19109(iOS - List - Device - Complex - Link - Medium) initial commit --- MVMCoreUI.xcodeproj/project.pbxproj | 20 +++++++++++++++++-- .../ListDeviceComplexLinkMedium.swift | 9 +++++++++ .../ListDeviceComplexLinkMediumModel.swift | 9 +++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift create mode 100644 MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index fe06c483..e958a395 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -151,7 +151,7 @@ 9432A79F23DB47BA00719041 /* EntryFieldContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9432A79E23DB47BA00719041 /* EntryFieldContainer.swift */; }; 943784F5236B77BB006A1E82 /* Wheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* Wheel.swift */; }; 943784F6236B77BB006A1E82 /* WheelAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* WheelAnimationHandler.swift */; }; - 943820842432382400B43AF3 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943820832432382400B43AF3 /* WebView.swift */; }; + 943820842432382400B43AF3 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943820832432382400B43AF3 /* WebView.swift */; }; 94382086243238D100B43AF3 /* WebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94382085243238D100B43AF3 /* WebViewModel.swift */; }; 9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */; }; 9445890E2385C3F800DE9FD4 /* MultiProgressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */; }; @@ -189,6 +189,8 @@ 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 */; }; + AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */; }; + AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */; }; AA56A20F243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A20E243C5EE900303286 /* ListTwoColumnSubsectionDividerModel.swift */; }; AA56A211243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA56A210243C5EFC00303286 /* ListTwoColumnSubsectionDivider.swift */; }; AA69AAF62445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */; }; @@ -625,6 +627,8 @@ 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 = ""; }; + AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMedium.swift; sourceTree = ""; }; + AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexLinkMediumModel.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 = ""; }; AA69AAF52445BF5700AF3D3B /* ListLeftVariableCheckboxBodyText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxBodyText.swift; sourceTree = ""; }; @@ -1102,6 +1106,15 @@ name = "Recovered References"; sourceTree = ""; }; + AA2AD114244EE43900BBFFE3 /* DeviceItems */ = { + isa = PBXGroup; + children = ( + AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */, + AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */, + ); + path = DeviceItems; + sourceTree = ""; + }; AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( @@ -1351,6 +1364,7 @@ D22B38EA23F4E08B00490EF6 /* List */ = { isa = PBXGroup; children = ( + AA2AD114244EE43900BBFFE3 /* DeviceItems */, 52267A0523FFE0A900906CBA /* OneColumn */, D22D8396241FDE4700D3DF69 /* TwoColumn */, 8DD1E36C243B3CD900D8F2DF /* ThreeColumn */, @@ -2103,6 +2117,7 @@ D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */, D21B7F602437C5BC00051ABF /* MoleculeStackView.swift in Sources */, 0A6682A42434DB8D00AD3CA1 /* ListLeftVariableRadioButtonBodyTextModel.swift in Sources */, + AA2AD116244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift in Sources */, D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */, D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */, 01004F3022721C3800991ECC /* RadioButton.swift in Sources */, @@ -2197,7 +2212,7 @@ D29E28D823D21AB800ACEA85 /* StringAndMoleculeView.swift in Sources */, 01EB369023609801006832FA /* MoleculeListItemModel.swift in Sources */, D28A838323CCBD3F00DFE4FC /* WheelModel.swift in Sources */, - EA5124FF2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift in Sources */, + EA5124FF2436018E0051A3A4 /* BGImageHeadlineBodyButtonModel.swift in Sources */, D268C70C2386DFFD007F2C1C /* MoleculeStackItemModel.swift in Sources */, DBEFFA04225A829700230692 /* Label.swift in Sources */, D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */, @@ -2314,6 +2329,7 @@ 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, 0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */, D20FB165241A5D75004AFC3A /* NavigationItemModelProtocol.swift in Sources */, + AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */, DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */, 0A21DB89235E06EF00C160A2 /* MFMdnTextField.m in Sources */, D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */, diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift new file mode 100644 index 00000000..bd49e09e --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift @@ -0,0 +1,9 @@ +// +// ListDeviceComplexLinkMedium.swift +// MVMCoreUI +// +// Created by Lekshmi S on 21/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift new file mode 100644 index 00000000..30cf9a6a --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift @@ -0,0 +1,9 @@ +// +// ListDeviceComplexLinkMediumModel.swift +// MVMCoreUI +// +// Created by Lekshmi S on 21/04/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation From 92ca8f23266e43cd7cc0ad593c08d1876c9e1f9d Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Tue, 21 Apr 2020 18:33:41 +0530 Subject: [PATCH 2/6] Added model and molecule class files. --- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 1 + .../ListDeviceComplexLinkMedium.swift | 66 +++++++++++++++++ .../ListDeviceComplexLinkMediumModel.swift | 71 +++++++++++++++++++ 3 files changed, 138 insertions(+) diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 2e98d344..0395f37e 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -151,6 +151,7 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift index bd49e09e..53c957b4 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift @@ -7,3 +7,69 @@ // import Foundation +@objcMembers open class ListDeviceComplexLinkMedium: TableViewCell { + + //----------------------------------------------------- + // MARK: - Outlets + //----------------------------------------------------- + private let stack: Stack + public let eyebrow = Label.createLabelRegularMicro(true) + public let headline = Label.createLabelBoldTitleMedium(true) + public let body = Label.createLabelRegularBodySmall(true) + public let body2 = Label.createLabelRegularBodySmall(true) + public let link = Link() + public let rightImage = MFLoadImageView(pinnedEdges: .all) + let leftStack: Stack + + //------------------------------------------------------ + // MARK: - Initializers + //------------------------------------------------------ + public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + leftStack = Stack.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0) + leftStack.stackModel?.molecules[4].spacing = 16 + rightImage.addSizeConstraintsForAspectRatio = true + stack = Stack.createStack(with: [(view: leftStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal) + super.init(style: style, reuseIdentifier: reuseIdentifier) + } + + public required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + //----------------------------------------------------- + // MARK: - View Lifecycle + //----------------------------------------------------- + open override func setupView() { + super.setupView() + addMolecule(stack) + stack.restack() + leftStack.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? ListDeviceComplexLinkMediumModel else { return } + eyebrow.setOptional(with: model.eyebrow, delegateObject, additionalData) + headline.setOptional(with: model.headline, delegateObject, additionalData) + body.setOptional(with: model.body, delegateObject, additionalData) + body2.setOptional(with: model.body2, delegateObject, additionalData) + link.set(with: model.link, delegateObject, additionalData) + rightImage.set(with: model.image, delegateObject, additionalData) + } + + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 120 + } + + open override func reset() { + super.reset() + eyebrow.styleRegularMicro(true) + headline.styleBoldTitleMedium(true) + body.styleRegularBodySmall(true) + body2.styleRegularBodySmall(true) + } +} + diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift index 30cf9a6a..683a7d52 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift @@ -7,3 +7,74 @@ // import Foundation +public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProtocol { + + public static var identifier: String = "listDvcLnkM" + public var eyebrow: LabelModel? + public var headline: LabelModel? + public var body: LabelModel? + public var body2: LabelModel? + public var link: LinkModel + public var image: ImageViewModel + + public init(eyebrow: LabelModel, headline: LabelModel, body: LabelModel, body2: LabelModel, link: LinkModel, image: ImageViewModel) { + self.eyebrow = eyebrow + self.headline = headline + self.body = body + self.body2 = body2 + self.link = link + self.image = image + super.init() + } + + /// Defaults to set + override public func setDefaults() { + super.setDefaults() + eyebrow?.textColor = Color(uiColor: .mvmCoolGray6) + if image.width == nil, image.height == nil { + image.width = 116 + image.height = 116 + } + } + + private enum CodingKeys: String, CodingKey { + case moleculeName + case eyebrow + case headline + case body + case body2 + case link + case image + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + if let eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) { + self.eyebrow = eyebrow + } + if let headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline) { + self.headline = headline + } + if let body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body) { + self.body = body + } + if let body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2) { + self.body2 = body2 + } + link = try typeContainer.decode(LinkModel.self, forKey: .link) + image = try typeContainer.decode(ImageViewModel.self, forKey: .image) + 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.encodeIfPresent(eyebrow, forKey: .eyebrow) + try container.encodeIfPresent(headline, forKey: .headline) + try container.encodeIfPresent(body, forKey: .body) + try container.encodeIfPresent(body2, forKey: .body2) + try container.encode(link, forKey: .link) + try container.encode(image, forKey: .image) + } +} From 0f4c11e2f2b7e9cd906c66eb537d9296b6fe5aef Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 24 Apr 2020 12:40:11 +0530 Subject: [PATCH 3/6] Code cleanup and realigned file structure. --- MVMCoreUI.xcodeproj/project.pbxproj | 12 ++--------- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 3 +-- .../ListDeviceComplexLinkMedium.swift | 21 ++++++++----------- .../ListDeviceComplexLinkMediumModel.swift | 18 ++++------------ 4 files changed, 16 insertions(+), 38 deletions(-) rename MVMCoreUI/Atomic/Molecules/DesignedComponents/List/{DeviceItems => Device}/ListDeviceComplexLinkMedium.swift (65%) rename MVMCoreUI/Atomic/Molecules/DesignedComponents/List/{DeviceItems => Device}/ListDeviceComplexLinkMediumModel.swift (78%) diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index 2b5f17be..6511b1d2 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -1122,15 +1122,6 @@ name = "Recovered References"; sourceTree = ""; }; - AA2AD114244EE43900BBFFE3 /* DeviceItems */ = { - isa = PBXGroup; - children = ( - AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */, - AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */, - ); - path = DeviceItems; - sourceTree = ""; - }; AA4FC2A323F4F69600E251DB /* RightVariable */ = { isa = PBXGroup; children = ( @@ -1190,6 +1181,8 @@ children = ( BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */, BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */, + AA2AD117244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift */, + AA2AD115244EE46800BBFFE3 /* ListDeviceComplexLinkMedium.swift */, ); path = Device; sourceTree = ""; @@ -1393,7 +1386,6 @@ isa = PBXGroup; children = ( D20FFFB42451E32100A31DA2 /* Device */, - AA2AD114244EE43900BBFFE3 /* DeviceItems */, 52267A0523FFE0A900906CBA /* OneColumn */, D22D8396241FDE4700D3DF69 /* TwoColumn */, 8DD1E36C243B3CD900D8F2DF /* ThreeColumn */, diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift index 3ea55ae6..55aa6e9a 100644 --- a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -152,7 +152,6 @@ import Foundation MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnInternationalData.self, viewModelClass: ListThreeColumnInternationalDataModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnDataUsage.self, viewModelClass: ListThreeColumnDataUsageModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageListItem.self, viewModelClass: ListFourColumnDataUsageListItemModel.self) - MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self) // Designed Section Dividers MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) @@ -169,9 +168,9 @@ import Foundation // Designed Headers MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) - // Device Items MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexButtonMedium.self, viewModelClass: ListDeviceComplexButtonMediumModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListDeviceComplexLinkMedium.self, viewModelClass: ListDeviceComplexLinkMediumModel.self) // TODO: Need View try? ModelRegistry.register(TabsModel.self) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift similarity index 65% rename from MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift index 53c957b4..e829554a 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift @@ -12,23 +12,23 @@ import Foundation //----------------------------------------------------- // MARK: - Outlets //----------------------------------------------------- - private let stack: Stack public let eyebrow = Label.createLabelRegularMicro(true) public let headline = Label.createLabelBoldTitleMedium(true) public let body = Label.createLabelRegularBodySmall(true) public let body2 = Label.createLabelRegularBodySmall(true) public let link = Link() - public let rightImage = MFLoadImageView(pinnedEdges: .all) - let leftStack: Stack + public let rightImage = MFLoadImageView() + let verticalStack: Stack + public let stack: Stack //------------------------------------------------------ // MARK: - Initializers //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - leftStack = Stack.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 0) - leftStack.stackModel?.molecules[4].spacing = 16 rightImage.addSizeConstraintsForAspectRatio = true - stack = Stack.createStack(with: [(view: leftStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal) + verticalStack = Stack.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0) + + stack = Stack.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -43,7 +43,7 @@ import Foundation super.setupView() addMolecule(stack) stack.restack() - leftStack.restack() + verticalStack.restack() } //------------------------------------------------------ @@ -52,11 +52,7 @@ import Foundation open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListDeviceComplexLinkMediumModel else { return } - eyebrow.setOptional(with: model.eyebrow, delegateObject, additionalData) - headline.setOptional(with: model.headline, delegateObject, additionalData) - body.setOptional(with: model.body, delegateObject, additionalData) - body2.setOptional(with: model.body2, delegateObject, additionalData) - link.set(with: model.link, delegateObject, additionalData) + verticalStack.updateContainedMolecules(with: [model.eyebrow, model.headline, model.body, model.body2, model.link], delegateObject, additionalData) rightImage.set(with: model.image, delegateObject, additionalData) } @@ -70,6 +66,7 @@ import Foundation headline.styleBoldTitleMedium(true) body.styleRegularBodySmall(true) body2.styleRegularBodySmall(true) + eyebrow.textColor = .mvmCoolGray6 } } diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift similarity index 78% rename from MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift index 683a7d52..66c88183 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/DeviceItems/ListDeviceComplexLinkMediumModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift @@ -8,7 +8,6 @@ import Foundation public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProtocol { - public static var identifier: String = "listDvcLnkM" public var eyebrow: LabelModel? public var headline: LabelModel? @@ -30,7 +29,6 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto /// Defaults to set override public func setDefaults() { super.setDefaults() - eyebrow?.textColor = Color(uiColor: .mvmCoolGray6) if image.width == nil, image.height == nil { image.width = 116 image.height = 116 @@ -49,18 +47,10 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - if let eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) { - self.eyebrow = eyebrow - } - if let headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline) { - self.headline = headline - } - if let body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body) { - self.body = body - } - if let body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2) { - self.body2 = body2 - } + eyebrow = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .eyebrow) + headline = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .headline) + body = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body) + body2 = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .body2) link = try typeContainer.decode(LinkModel.self, forKey: .link) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) try super.init(from: decoder) From 4ede519024dc20a49bac39749d33ad8e2835fedd Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 24 Apr 2020 16:38:42 +0530 Subject: [PATCH 4/6] Minor changes --- .../List/Device/ListDeviceComplexLinkMedium.swift | 2 ++ .../List/Device/ListDeviceComplexLinkMediumModel.swift | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift index e829554a..4875e563 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift @@ -26,6 +26,8 @@ import Foundation //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { rightImage.addSizeConstraintsForAspectRatio = true + rightImage.heightAnchor.constraint(equalToConstant: 116.0).isActive = true + rightImage.widthAnchor.constraint(equalToConstant: 116.0).isActive = true verticalStack = Stack.createStack(with: [(view: eyebrow, model: StackItemModel(horizontalAlignment: .leading)), (view: headline, model: StackItemModel(horizontalAlignment: .leading)), (view: body, model: StackItemModel(horizontalAlignment: .leading)), (view: body2, model: StackItemModel(horizontalAlignment: .leading)), (view: link, model: StackItemModel(spacing: 16, horizontalAlignment: .leading))], axis: .vertical, spacing: 0) stack = Stack.createStack(with: [(view: verticalStack, model: StackItemModel(horizontalAlignment: .leading)), (view: rightImage, model: StackItemModel(verticalAlignment: .center))], axis: .horizontal) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift index 66c88183..b85a6539 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift @@ -26,15 +26,6 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto super.init() } - /// Defaults to set - override public func setDefaults() { - super.setDefaults() - if image.width == nil, image.height == nil { - image.width = 116 - image.height = 116 - } - } - private enum CodingKeys: String, CodingKey { case moleculeName case eyebrow From e854eef315fe27d0cacc728ea578f307ea701e3d Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 24 Apr 2020 16:53:12 +0530 Subject: [PATCH 5/6] Removed extra line. --- .../List/Device/ListDeviceComplexLinkMedium.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift index 4875e563..f6e18184 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMedium.swift @@ -71,4 +71,3 @@ import Foundation eyebrow.textColor = .mvmCoolGray6 } } - From ac29a7d885f331abb56bfdaee231f3f18169500a Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 24 Apr 2020 16:04:41 -0400 Subject: [PATCH 6/6] remove space --- .../List/Device/ListDeviceComplexLinkMediumModel.swift | 2 +- .../List/Device/ListDeviceComplexLinkSmallModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift index b85a6539..c07d7788 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkMediumModel.swift @@ -47,7 +47,7 @@ public class ListDeviceComplexLinkMediumModel: ListItemModel, MoleculeModelProto try super.init(from: decoder) } - public override 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) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmallModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmallModel.swift index 03eeb902..a0b3047b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmallModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Device/ListDeviceComplexLinkSmallModel.swift @@ -47,7 +47,7 @@ public class ListDeviceComplexLinkSmallModel: ListItemModel, MoleculeModelProtoc try super.init(from: decoder) } - public override 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)