review comment updated
This commit is contained in:
parent
03ea6c528c
commit
46a3af5e6b
@ -203,7 +203,9 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
|
||||
open func newData(for molecule: MoleculeModelProtocol) {
|
||||
|
||||
if updateMoleculeViewByModelId(molecule: molecule) {
|
||||
//Check header and footer if replace happens then return.
|
||||
if updateMoleculeViewById(topView, with: molecule) ||
|
||||
updateMoleculeViewById(bottomView, with: molecule) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -226,15 +228,12 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
}
|
||||
}
|
||||
|
||||
///Helper functions to update the header/footer view
|
||||
//TODO: expand for navigation, etc
|
||||
private func updateMoleculeViewByModelId(molecule: MoleculeModelProtocol) -> Bool {
|
||||
let headerFooterViews = [topView, bottomView].compactMap({$0 as? MoleculeViewProtocol})
|
||||
for headerFooterView in headerFooterViews {
|
||||
if let moleculeView = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [headerFooterView]).first(where: { $0.model?.moleculeName == molecule.moleculeName && $0.model?.id == molecule.id }) {
|
||||
updateMoleculeView(moleculeView, from: molecule)
|
||||
return true
|
||||
}
|
||||
///Helper functions to update view with molecule
|
||||
private func updateMoleculeViewById(_ view: UIView?, with molecule: MoleculeModelProtocol) -> Bool {
|
||||
if let updateView = view,
|
||||
let moleculeView = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [updateView]).first(where: { $0.model?.moleculeName == molecule.moleculeName && $0.model?.id == molecule.id }) {
|
||||
updateMoleculeView(moleculeView, from: molecule)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user