From c43a3da712da4eeeed48e77f4c2547f722b6a459 Mon Sep 17 00:00:00 2001 From: Subhankar Acharya Date: Tue, 18 Feb 2020 16:06:30 +0530 Subject: [PATCH] Code commit after adding a createPayPal function. --- .../List/RightVariable/ListRightVariablePayments.swift | 3 +-- .../List/RightVariable/ListRightVariablePaymentsModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift index 91703fd7..046bc331 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift @@ -36,7 +36,6 @@ import Foundation stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)] contentView.addSubview(stack) containerHelper.constrainView(stack) - } //---------------------------------------------------- // MARK: - Molecule @@ -45,7 +44,7 @@ import Foundation super.reset() stack.reset() } -   + public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.setWithModel(model, delegateObject, additionalData) guard let model = model as? ListRightVariablePaymentsModel else { return} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift index 422cd193..681f2078 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift +++ b/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift @@ -20,7 +20,7 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco super.init() } - func createPayPalImage() -> ImageViewModel { + static func createPayPalImage() -> ImageViewModel { let image = ImageViewModel(image: "imagename_paypal") image.width = 30.0 return image @@ -35,7 +35,7 @@ public class ListRightVariablePaymentsModel: ListItemModel, MoleculeModelProtoco 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.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? createPayPalImage() + image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image) ?? ListRightVariablePaymentsModel.createPayPalImage() try super.init(from: decoder) }