switch modification
This commit is contained in:
parent
9ecc7f21a6
commit
85e9c56dcf
@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class Switch: ViewConstrainingView, FormValidationProtocol{
|
||||
public var mvmSwitch = UISwitch()
|
||||
public var mvmSwitch = MVMCoreUISwitch()
|
||||
var label = Label()
|
||||
var mfTextButton = MFTextButton()
|
||||
var isRequired: Bool! = false
|
||||
@ -38,6 +38,7 @@ import UIKit
|
||||
public override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
label.updateView(size)
|
||||
mvmSwitch.updateView(size)
|
||||
mfTextButton.updateView(size)
|
||||
}
|
||||
|
||||
@ -48,19 +49,26 @@ import UIKit
|
||||
if let dict = json?.optionalDictionaryForKey("label") {
|
||||
label.setWithJSON(dict, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
if let dict = json?.optionalDictionaryForKey("textButton") {
|
||||
mfTextButton.setWithJSON(dict, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
if let delegateObject = delegateObject as? MVMCoreUIDelegateObject {
|
||||
FormValidator.setupValidation(molecule: self, delegate: delegateObject.formValidationProtocol)
|
||||
}
|
||||
|
||||
if let onColorString = json?.optionalStringForKey("onTintColor") {
|
||||
mvmSwitch.onTintColor = .mfGet(forHex: onColorString)
|
||||
}
|
||||
mvmSwitch.isOn = json?.optionalBoolForKey("state") ?? false
|
||||
if let offColorString = json?.optionalStringForKey("offTintColor") {
|
||||
mvmSwitch.offTintColor = .mfGet(forHex: offColorString)
|
||||
}
|
||||
if let onKnobColorString = json?.optionalStringForKey("onKnobTintColor") {
|
||||
mvmSwitch.onKnobTintColor = .mfGet(forHex: onKnobColorString)
|
||||
}
|
||||
if let offKnobColorString = json?.optionalStringForKey("offKnobTintColor") {
|
||||
mvmSwitch.offKnobTintColor = .mfGet(forHex: offKnobColorString)
|
||||
}
|
||||
// mvmSwitch.isOn = json?.optionalBoolForKey("state") ?? false
|
||||
mvmSwitch.setState(json?.optionalBoolForKey("state") ?? false, animated: true)
|
||||
}
|
||||
|
||||
func setupConstraints(forView view: UIView) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user