From e32b9cfdda4c269ed5bd5961913a338c7bb22153 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 20 Nov 2019 13:29:16 -0500 Subject: [PATCH] PR comments --- MVMCoreUI/Atoms/Views/Line.swift | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Line.swift b/MVMCoreUI/Atoms/Views/Line.swift index a5934aac..f7a81ac5 100644 --- a/MVMCoreUI/Atoms/Views/Line.swift +++ b/MVMCoreUI/Atoms/Views/Line.swift @@ -26,28 +26,20 @@ import UIKit case .standard: heightConstraint?.constant = 1 backgroundColor = .mfSilver() - setNeedsLayout() - layoutIfNeeded() case .thin: heightConstraint?.constant = 1 backgroundColor = .black - setNeedsLayout() - layoutIfNeeded() case .medium: heightConstraint?.constant = 2 backgroundColor = .black - setNeedsLayout() - layoutIfNeeded() case .heavy: heightConstraint?.constant = 4 backgroundColor = .black - setNeedsLayout() - layoutIfNeeded() case .none: heightConstraint?.constant = 0 - setNeedsLayout() - layoutIfNeeded() } + setNeedsLayout() + layoutIfNeeded() } } @@ -74,6 +66,7 @@ import UIKit // MARK: - MVMCoreUIMoleculeViewProtocol open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { + // If no type, default to standard. if let typeString = json?.optionalStringForKey(KeyType), let type = Style.init(rawValue: typeString) { style = type } else { @@ -92,16 +85,16 @@ import UIKit } public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - guard let type = json?.optionalStringForKey(KeyType) else { return 0 } - switch type { - case "thin", "standard": - return 1 - case "medium": + guard let type = json?.optionalStringForKey(KeyType), let style = Style(rawValue: type) else { return 1 } + switch style { + case .none: + return 0 + case .medium: return 2 - case "heavy": + case .heavy: return 4 default: - return 0 + return 1 } } }