From e236e9c3a5cad39ac4b26b5403a7e2c85584605f Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 28 Jul 2020 10:34:48 -0400 Subject: [PATCH 1/2] bug fix for line if set by template --- .../Atomic/Molecules/Items/ListItemModel.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index fcee1166..477dc4a4 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -20,7 +20,7 @@ import Foundation public var action: ActionModelProtocol? public var hideArrow: Bool? public var line: LineModel? - public var style: ListItemStyle? = .standard + public var style: ListItemStyle? //-------------------------------------------------- // MARK: - Keys @@ -59,9 +59,12 @@ import Foundation } } - /// Convenience function to set common values based on style. + /// Convenience function to set common values based on style. We default to standard if not set. open func setByStyle() { - guard let style = style else { return } + guard let style = style else { + set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing) + return + } switch style { case .standard: set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing) @@ -104,9 +107,7 @@ import Foundation action = try typeContainer.decodeModelIfPresent(codingKey: .action) hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) - if let style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) { - self.style = style - } + style = try typeContainer.decodeIfPresent(ListItemStyle.self, forKey: .style) try super.init(from: decoder) } From 02ab457c1ab47eb75eb9903745be2350d820867e Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 28 Jul 2020 10:47:52 -0400 Subject: [PATCH 2/2] comment update --- MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift index 477dc4a4..4c34cc39 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift @@ -61,10 +61,7 @@ import Foundation /// Convenience function to set common values based on style. We default to standard if not set. open func setByStyle() { - guard let style = style else { - set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing) - return - } + let style = self.style ?? .standard switch style { case .standard: set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing)