From 6de4fc486445b1f0c66557ee520698c458e1fcbe Mon Sep 17 00:00:00 2001 From: "Suresh, Kamlesh" Date: Mon, 17 Feb 2020 14:19:17 -0500 Subject: [PATCH] fill color --- MVMCoreUI/BaseClasses/Button.swift | 9 ++++----- MVMCoreUI/Templates/IsaacLandingTemplate.swift | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/BaseClasses/Button.swift b/MVMCoreUI/BaseClasses/Button.swift index 24378184..60e0ab1a 100644 --- a/MVMCoreUI/BaseClasses/Button.swift +++ b/MVMCoreUI/BaseClasses/Button.swift @@ -88,13 +88,12 @@ public typealias ButtonAction = (Button) -> () // MARK:- ModelMoleculeViewProtocol open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model - - guard let model = model as? ButtonModelProtocol else { return } - isEnabled = model.enabled - - if let backgroundColor = (model as? MoleculeModelProtocol)?.backgroundColor { + if let backgroundColor = model?.backgroundColor { self.backgroundColor = backgroundColor.uiColor } + + guard let model = model as? ButtonModelProtocol else { return } + isEnabled = model.enabled set(with: model.action, delegateObject: delegateObject, additionalData: additionalData) } diff --git a/MVMCoreUI/Templates/IsaacLandingTemplate.swift b/MVMCoreUI/Templates/IsaacLandingTemplate.swift index 0001c744..c3d9e9cb 100644 --- a/MVMCoreUI/Templates/IsaacLandingTemplate.swift +++ b/MVMCoreUI/Templates/IsaacLandingTemplate.swift @@ -55,7 +55,7 @@ open class IsaacLandingTemplate: MoleculeListTemplate { if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { let decoder = JSONDecoder() twoButtonModel.primaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.primaryButton?.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) + twoButtonModel.primaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonBGColor)) twoButtonModel.primaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) } } @@ -66,7 +66,7 @@ open class IsaacLandingTemplate: MoleculeListTemplate { if let data = try? JSONSerialization.data(withJSONObject: buttonDict) { let decoder = JSONDecoder() twoButtonModel.secondaryButton = try? decoder.decode(ButtonModel.self, from: data) - twoButtonModel.secondaryButton?.backgroundColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) + twoButtonModel.secondaryButton?.fillColor = Color(uiColor: UIColor.mfGet(forHex: primaryButtonTextColor)) twoButtonModel.secondaryButton?.textColor = Color(uiColor: UIColor.mfGet(forHex:primaryButtonBGColor)) } }