Fixed setWithJSON, allows it to work properly with Atom molecule. Provided more properties to control.
This commit is contained in:
parent
de0c031b7f
commit
499f9eb55d
@ -112,9 +112,7 @@ open class CaretButton: MFCustomButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) {
|
@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 }
|
guard let jsonDictionary = json else { return }
|
||||||
|
|
||||||
if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String {
|
if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String {
|
||||||
@ -128,5 +126,17 @@ open class CaretButton: MFCustomButton {
|
|||||||
if let disabledColorHex = jsonDictionary["disabledColor"] as? String {
|
if let disabledColorHex = jsonDictionary["disabledColor"] as? String {
|
||||||
disabledColor = UIColor.mfGet(forHex: disabledColorHex)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user