fix to load timing issue for list
This commit is contained in:
parent
5a9e1a9a93
commit
93dfde6fc6
@ -10,7 +10,6 @@ import UIKit
|
||||
|
||||
open class MoleculeListTemplate: ThreeLayerTableViewController {
|
||||
var moleculesInfo: [(identifier: String, class: AnyClass, molecule: [AnyHashable: Any])]?
|
||||
var modulesRequired: NSMutableArray?
|
||||
|
||||
open override func viewForTop() -> UIView {
|
||||
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("header"),
|
||||
@ -30,6 +29,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
||||
|
||||
open override func newDataBuildScreen() {
|
||||
super.newDataBuildScreen()
|
||||
setup()
|
||||
registerWithTable()
|
||||
}
|
||||
|
||||
@ -116,27 +116,28 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
||||
}
|
||||
|
||||
/// Sets up the header, footer, molecule list and ensures no errors loading all content.
|
||||
func setup(fromPageJSON page: [AnyHashable : Any]?) {
|
||||
let modules: NSMutableArray = []
|
||||
let delegate = delegateObject() as? MVMCoreUIDelegateObject
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: page?.optionalDictionaryForKey("header"), delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: page?.optionalDictionaryForKey("footer"), delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
|
||||
func setup() {
|
||||
var moleculeList: [(identifier: String, class: AnyClass, molecule: [AnyHashable: Any])] = []
|
||||
if let molecules = page?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] {
|
||||
if let molecules = loadObject?.pageJSON?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] {
|
||||
for molecule in molecules {
|
||||
if let info = getMoleculeInfo(with: molecule) {
|
||||
moleculeList.append(info)
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: molecule, delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
moleculesInfo = moleculeList
|
||||
modulesRequired = modules
|
||||
}
|
||||
|
||||
open override func requiredModules(fromPageJSON page: [AnyHashable : Any]?) -> [Any]? {
|
||||
setup(fromPageJSON: page)
|
||||
return modulesRequired as? [Any]
|
||||
let modules: NSMutableArray = []
|
||||
let delegate = delegateObject() as? MVMCoreUIDelegateObject
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: page?.optionalDictionaryForKey("header"), delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: page?.optionalDictionaryForKey("footer"), delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
if let molecules = page?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] {
|
||||
for molecule in molecules {
|
||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: molecule, delegateObject: delegate, moduleList: modules, errorList: nil)
|
||||
}
|
||||
}
|
||||
return modules as? [Any]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user