// // MoleculeContainer.swift // MVMCoreUI // // Created by Scott Pfeil on 12/12/19. // Copyright © 2019 Verizon Wireless. All rights reserved. // import UIKit open class MoleculeContainer: Container { override public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { guard let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule) else { super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) return } if view == nil { if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) { addAndContain(molecule) } } else { (view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData) } super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) } }