Merge branch 'bugfix/list_lines' into 'develop'

bug fix for line if set by template

See merge request BPHV_MIPS/mvm_core_ui!548
This commit is contained in:
Hedden, Kyle Matthew 2020-07-28 11:56:32 -04:00
commit c21ce6843f

View File

@ -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,9 @@ 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 }
let style = self.style ?? .standard
switch style {
case .standard:
set(topPadding: Padding.Component.VerticalMarginSpacing, bottomPadding: Padding.Component.VerticalMarginSpacing)
@ -104,9 +104,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)
}