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]?) {
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.