diff --git a/MVMCoreUI/Atoms/Buttons/CaretButton.swift b/MVMCoreUI/Atoms/Buttons/CaretButton.swift index 9f48d358..930cdd68 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretButton.swift +++ b/MVMCoreUI/Atoms/Buttons/CaretButton.swift @@ -109,34 +109,24 @@ open class CaretButton: MFCustomButton { @objc open override func setAsMolecule() { backgroundColor = .clear + setTitle(actionMap?.optionalStringForKey(KeyTitle), for: .normal) } @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) { - - guard let jsonDictionary = json else { return } + setWithActionMap(actionMap, delegate: delegate as? (MVMCoreActionDelegateProtocol & NSObjectProtocol), additionalData: additionalData) - if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String { + guard let dictionary = json else { return } + + if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) } - if let enableColorHex = jsonDictionary["enableColor"] as? String { + if let enableColorHex = dictionary["enableColor"] as? String { enabledColor = UIColor.mfGet(forHex: enableColorHex) } - if let disabledColorHex = jsonDictionary["disabledColor"] as? String { + if let disabledColorHex = dictionary["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) - } } }