From 23b2df3c825640d943ad9c1f6c3647a201152787 Mon Sep 17 00:00:00 2001 From: Lekshmi S Date: Fri, 14 Feb 2020 12:35:43 +0530 Subject: [PATCH] Code commit - Conforming to ListItemModel and MoleculeModelProtocol based on review comments. --- .../ListRightVariablePayments.swift | 4 +-- .../ListRightVariablePaymentsModel.swift | 25 +------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 626e8d42..5f2870ec 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -54,9 +54,9 @@ import Foundation rightImage.setWithModel(model.image, delegateObject, additionalData) // Create a stack model to use for the internal stack and set the alignment of label and image - let leftLabel = StackItemModel() + let leftLabel = StackItemModel(percent: 60) leftLabel.horizontalAlignment = .leading - let rightImage = StackItemModel() + let rightImage = StackItemModel(percent: 40) rightImage.horizontalAlignment = .trailing let stackModel = StackModel(molecules: [leftLabel,rightImage]) stackModel.axis = .horizontal diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 97f8e1d2..23545142 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -8,49 +8,29 @@ import Foundation -public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtocol { +public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtocol { - public var line: LineModel? - public var style: String? = "standard" - public var hideArrow: Bool? = false - public var backgroundColor: Color? - public var action: ActionModelProtocol? public static var identifier: String = "listRVImg" public var image: ImageViewModel public var leftLabel: LabelModel - func setDefaults() { - if useHorizontalMargins == nil { - useHorizontalMargins = true - } - if useVerticalMargins == nil { - useVerticalMargins = true - } - } - public init(image: ImageViewModel, leftLabel: LabelModel) { self.image = image self.leftLabel = leftLabel super.init() - setDefaults() } private enum CodingKeys: String, CodingKey { case moleculeName case leftLabel case image - case action - case backgroundColor } required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) image = try typeContainer.decode(ImageViewModel.self, forKey: .image) - action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType) - backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) try super.init(from: decoder) - setDefaults() } public override func encode(to encoder: Encoder) throws { @@ -59,8 +39,5 @@ public class ListRightVariablePaymentsModel: ContainerModel, ListItemModelProtoc try container.encode(moleculeName, forKey: .moleculeName) try container.encode(leftLabel, forKey: .leftLabel) try container.encode(image, forKey: .image) - try container.encodeModelIfPresent(action, forKey: .action) - try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) - } }