From 16c644e12df047bec665877ad7142cde4cf326e8 Mon Sep 17 00:00:00 2001 From: "Christiano, Kevin" Date: Mon, 1 Apr 2019 13:28:15 -0400 Subject: [PATCH] Removed super call for setWithJSON. Provided more functionality for atom steup. --- MVMCoreUI/Atoms/Buttons/CaretButton.swift | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/CaretButton.swift b/MVMCoreUI/Atoms/Buttons/CaretButton.swift index af7d1d60..c85093d4 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretButton.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretButton.swift @@ -52,7 +52,7 @@ open class CaretButton: MFCustomButton { public func setEnabled(_ enabled: Bool) { super.isEnabled = enabled - + changeCaretColor() } @@ -112,21 +112,31 @@ open class CaretButton: MFCustomButton { } @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegate: delegate, additionalData: additionalData) - - // Configure class properties with JSON values + guard let jsonDictionary = json else { return } if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String { backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) } - if let enableColorHex = jsonDictionary["enableColor"] as? String { + if let enableColorHex = jsonDictionary["enabledColor"] as? String { enabledColor = UIColor.mfGet(forHex: enableColorHex) } if let disabledColorHex = jsonDictionary["disabledColor"] as? String { disabledColor = UIColor.mfGet(forHex: disabledColorHex) } + + if let caretViewHeight = jsonDictionary["caretViewHeight"] as? NSNumber { + rightViewHeight = caretViewHeight + } + + if let caretViewWidth = jsonDictionary["caretViewWidth"] as? NSNumber { + rightViewWidth = caretViewWidth + } + + if let buttonText = jsonDictionary["buttonText"] as? String { + setTitle(buttonText, for: .normal) + } } }