kevin comment

This commit is contained in:
Pfeil, Scott Robert 2019-10-29 15:26:43 -04:00
parent e98a0ce76b
commit 2fab14d946

View File

@ -141,24 +141,26 @@ import UIKit
public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
self.json = json 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 updateViewHorizontalDefaults = useHorizontalMargins
} }
if (json?.optionalBoolForKey("useVerticalMargins") ?? true) == false { if (json.optionalBoolForKey("useVerticalMargins") ?? true) == false {
topMarginPadding = 0 topMarginPadding = 0
bottomMarginPadding = 0 bottomMarginPadding = 0
} }
if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) { if let backgroundColorString = json.optionalStringForKey(KeyBackgroundColor) {
backgroundColor = UIColor.mfGet(forHex: backgroundColorString) backgroundColor = UIColor.mfGet(forHex: backgroundColorString)
} }
// Add the caret if there is an action and it's not declared hidden. // Add the caret if there is an action and it's not declared hidden.
if !customAccessoryView { if !customAccessoryView {
if let _ = json?.optionalDictionaryForKey("actionMap"), !json!.boolForKey("hideArrow") { if let _ = json.optionalDictionaryForKey("actionMap"), !json.boolForKey("hideArrow") {
addCaretViewAccessory() addCaretViewAccessory()
} else { } else {
accessoryView = nil accessoryView = nil
@ -166,12 +168,12 @@ import UIKit
} }
// override the separator // override the separator
if let separator = json?.optionalDictionaryForKey("separator") { if let separator = json.optionalDictionaryForKey("separator") {
addSeparatorsIfNeeded() addSeparatorsIfNeeded()
bottomSeparatorView?.setWithJSON(separator, delegateObject: delegateObject, additionalData: additionalData) 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) molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
// This molecule will by default handle margins. // This molecule will by default handle margins.