set with json removed
This commit is contained in:
parent
30d864749a
commit
b4859988c2
@ -72,11 +72,6 @@ class LeftLabelRightMoleculeContainer: View {
|
|||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(withJSON json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.init(frame: CGRect.zero)
|
|
||||||
setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
public required init?(coder aDecoder: NSCoder) {
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
@ -157,28 +152,6 @@ class LeftLabelRightMoleculeContainer: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
let previousMoleculeName = rightMoleculeName
|
|
||||||
removeSubviewsInRightContainer()
|
|
||||||
guard let moleculeJSON = json, let _ = moleculeJSON.optionalStringForKey(KeyMoleculeName) else {
|
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
label.text = leftText
|
|
||||||
rightMoleculeName = moleculeJSON.optionalStringForKey(KeyMoleculeName)
|
|
||||||
//For reuse purpose check that allready added molecule is same
|
|
||||||
if let rightMolecule = self.rightMolecule, previousMoleculeName == rightMoleculeName {
|
|
||||||
rightMolecule.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
addView(rightMolecule)
|
|
||||||
} else {
|
|
||||||
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) {
|
|
||||||
addView(molecule)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateLeftViewWidthConstraint(_ percent: CGFloat) {
|
func updateLeftViewWidthConstraint(_ percent: CGFloat) {
|
||||||
percentage = percent
|
percentage = percent
|
||||||
leftWidthConstraint?.isActive = false
|
leftWidthConstraint?.isActive = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user