From 2fab14d946404e49d310b6da8b7df091536050f8 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 29 Oct 2019 15:26:43 -0400 Subject: [PATCH] kevin comment --- MVMCoreUI/Molecules/Items/TableViewCell.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MVMCoreUI/Molecules/Items/TableViewCell.swift b/MVMCoreUI/Molecules/Items/TableViewCell.swift index e8cfc179..cc531d75 100644 --- a/MVMCoreUI/Molecules/Items/TableViewCell.swift +++ b/MVMCoreUI/Molecules/Items/TableViewCell.swift @@ -141,24 +141,26 @@ import UIKit public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { self.json = json - style(with: json?.optionalStringForKey("style")) + guard let json = json else { return } - if let useHorizontalMargins = json?.optionalBoolForKey("useHorizontalMargins") { + style(with: json.optionalStringForKey("style")) + + if let useHorizontalMargins = json.optionalBoolForKey("useHorizontalMargins") { updateViewHorizontalDefaults = useHorizontalMargins } - if (json?.optionalBoolForKey("useVerticalMargins") ?? true) == false { + if (json.optionalBoolForKey("useVerticalMargins") ?? true) == false { topMarginPadding = 0 bottomMarginPadding = 0 } - if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) { + if let backgroundColorString = json.optionalStringForKey(KeyBackgroundColor) { backgroundColor = UIColor.mfGet(forHex: backgroundColorString) } // Add the caret if there is an action and it's not declared hidden. if !customAccessoryView { - if let _ = json?.optionalDictionaryForKey("actionMap"), !json!.boolForKey("hideArrow") { + if let _ = json.optionalDictionaryForKey("actionMap"), !json.boolForKey("hideArrow") { addCaretViewAccessory() } else { accessoryView = nil @@ -166,12 +168,12 @@ import UIKit } // override the separator - if let separator = json?.optionalDictionaryForKey("separator") { + if let separator = json.optionalDictionaryForKey("separator") { addSeparatorsIfNeeded() bottomSeparatorView?.setWithJSON(separator, delegateObject: delegateObject, additionalData: additionalData) } - guard let json = json, let moleculeJSON = json.optionalDictionaryForKey(KeyMolecule) else { return } + guard let moleculeJSON = json.optionalDictionaryForKey(KeyMolecule) else { return } molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData) // This molecule will by default handle margins.