Switch molecule
This commit is contained in:
parent
344163de49
commit
b73c916192
@ -26,7 +26,6 @@ import UIKit
|
||||
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
// mvmSwitch.addTarget(self, action: #selector(SwitchLineItem.switchChanged), for: .valueChanged)
|
||||
leftContainerView.addSubview(label)
|
||||
leftContainerView.addSubview(mfTextButton)
|
||||
addSubview(leftContainerView)
|
||||
@ -53,23 +52,6 @@ import UIKit
|
||||
mvmSwitch.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
label.setWithJSON(json?.optionalDictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
mfTextButton.setWithJSON(json?.optionalDictionaryForKey("textButton"), 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)
|
||||
// }
|
||||
// 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.setState(json?.optionalBoolForKey("state") ?? false, animated: true)
|
||||
// if left container no width
|
||||
if (label.text?.count ?? 0) <= 0 && (mfTextButton.titleLabel?.text?.count ?? 0) <= 0 {
|
||||
mvmSwitch.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 0).isActive = true
|
||||
}
|
||||
@ -127,20 +109,11 @@ import UIKit
|
||||
mfTextButton.topAnchor.constraint(equalTo: label.bottomAnchor).isActive = true
|
||||
leftContainerView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||
mvmSwitch.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
|
||||
}
|
||||
|
||||
// public func isValidField() -> Bool {
|
||||
// return (isRequired == false) ? true : mvmSwitch.isOn
|
||||
// }
|
||||
|
||||
public func formFieldName() -> String? {
|
||||
return json?.optionalStringForKey(KeyFieldKey)
|
||||
}
|
||||
//
|
||||
// public func formFieldValue() -> Any? {
|
||||
// return mvmSwitch.isOn
|
||||
// }
|
||||
|
||||
public override func needsToBeConstrained() -> Bool {
|
||||
return true
|
||||
@ -149,7 +122,6 @@ import UIKit
|
||||
public override func moleculeAlignment() -> UIStackView.Alignment {
|
||||
return UIStackView.Alignment.leading
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user