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 {
|
open class MoleculeListTemplate: ThreeLayerTableViewController {
|
||||||
var moleculesInfo: [(identifier: String, class: AnyClass, molecule: [AnyHashable: Any])]?
|
var moleculesInfo: [(identifier: String, class: AnyClass, molecule: [AnyHashable: Any])]?
|
||||||
var modulesRequired: NSMutableArray?
|
|
||||||
|
|
||||||
open override func viewForTop() -> UIView {
|
open override func viewForTop() -> UIView {
|
||||||
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("header"),
|
guard let moleculeJSON = loadObject?.pageJSON?.optionalDictionaryForKey("header"),
|
||||||
@ -30,6 +29,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
|||||||
|
|
||||||
open override func newDataBuildScreen() {
|
open override func newDataBuildScreen() {
|
||||||
super.newDataBuildScreen()
|
super.newDataBuildScreen()
|
||||||
|
setup()
|
||||||
registerWithTable()
|
registerWithTable()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,27 +116,28 @@ open class MoleculeListTemplate: ThreeLayerTableViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sets up the header, footer, molecule list and ensures no errors loading all content.
|
/// Sets up the header, footer, molecule list and ensures no errors loading all content.
|
||||||
func setup(fromPageJSON page: [AnyHashable : Any]?) {
|
func setup() {
|
||||||
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)
|
|
||||||
|
|
||||||
var moleculeList: [(identifier: String, class: AnyClass, molecule: [AnyHashable: Any])] = []
|
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 {
|
for molecule in molecules {
|
||||||
if let info = getMoleculeInfo(with: molecule) {
|
if let info = getMoleculeInfo(with: molecule) {
|
||||||
moleculeList.append(info)
|
moleculeList.append(info)
|
||||||
MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: molecule, delegateObject: delegate, moduleList: modules, errorList: nil)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
moleculesInfo = moleculeList
|
moleculesInfo = moleculeList
|
||||||
modulesRequired = modules
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func requiredModules(fromPageJSON page: [AnyHashable : Any]?) -> [Any]? {
|
open override func requiredModules(fromPageJSON page: [AnyHashable : Any]?) -> [Any]? {
|
||||||
setup(fromPageJSON: page)
|
let modules: NSMutableArray = []
|
||||||
return modulesRequired as? [Any]
|
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