From 499f9eb55db81be5577b44ba8c2555cd5fb3877b Mon Sep 17 00:00:00 2001 From: "Christiano, Kevin" Date: Mon, 1 Apr 2019 13:30:31 -0400 Subject: [PATCH] Fixed setWithJSON, allows it to work properly with Atom molecule. Provided more properties to control. --- MVMCoreUI/Atoms/Buttons/CaretButton.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Atoms/Buttons/CaretButton.swift b/MVMCoreUI/Atoms/Buttons/CaretButton.swift index af7d1d60..9f48d358 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretButton.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretButton.swift @@ -112,9 +112,7 @@ 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 { @@ -128,5 +126,17 @@ open class CaretButton: MFCustomButton { 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) + } } }