Merge branch 'feature/atomization_ke' into 'develop'

Fixed setWithJSON, allows it to work properly with Atom molecule.

See merge request BPHV_MIPS/mvm_core_ui!19
This commit is contained in:
Pfeil, Scott Robert 2019-04-03 13:29:22 -04:00
commit 1c33ba0c09

View File

@ -109,23 +109,24 @@ open class CaretButton: MFCustomButton {
@objc open override func setAsMolecule() {
backgroundColor = .clear
setTitleColor(enabledColor, for: .normal)
setTitleColor(disabledColor, for: .disabled)
}
@objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegate: NSObject?, additionalData: [AnyHashable: Any]?) {
super.setWithJSON(json, delegate: delegate, additionalData: additionalData)
setWithActionMap(json, delegate: delegate as? (MVMCoreActionDelegateProtocol & NSObjectProtocol), additionalData: additionalData)
// Configure class properties with JSON values
guard let jsonDictionary = json else { return }
guard let dictionary = json else { return }
if let backgroundColorHex = jsonDictionary[KeyBackgroundColor] as? String {
if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String {
backgroundColor = UIColor.mfGet(forHex: backgroundColorHex)
}
if let enableColorHex = jsonDictionary["enableColor"] as? String {
enabledColor = UIColor.mfGet(forHex: enableColorHex)
if let enabledColorHex = dictionary["enabledColor"] as? String {
enabledColor = UIColor.mfGet(forHex: enabledColorHex)
}
if let disabledColorHex = jsonDictionary["disabledColor"] as? String {
if let disabledColorHex = dictionary["disabledColor"] as? String {
disabledColor = UIColor.mfGet(forHex: disabledColorHex)
}
}