From 4f4d9a126e331f5ed54cf7f85c992d49342ee612 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Fri, 5 Aug 2022 22:02:47 +0530 Subject: [PATCH] Reordering the conditions for button style update. --- MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift index 3c702d49..4f4801c6 100644 --- a/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift @@ -206,11 +206,11 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat title = try typeContainer.decode(String.self, forKey: .title) action = try typeContainer.decodeModel(codingKey: .action) - ///Reading the style param from context which is set is molecules, ex: TwoButtonView - if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style{ + ///Style captured from the JSON + if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style){ self.style = style setFacade(by: style) - } else if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style) { ///Style captured from the JSON + } else if let style = decoder.context?.value(forKey: CodingKeys.style.stringValue) as? Styler.Button.Style { ///Reading the style param from context which is set is molecules, ex: TwoButtonView self.style = style setFacade(by: style) } else { ///Default style