Code commit after adding a createPayPal function.

This commit is contained in:
Subhankar Acharya 2020-02-18 16:06:30 +05:30
parent 273b131714
commit c43a3da712
2 changed files with 3 additions and 4 deletions

View File

@ -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}

View File

@ -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)
}