update only after the model sets the properties

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-08-20 13:59:52 -05:00
parent 8829bd7457
commit 7b0f4e4328

View File

@ -14,10 +14,12 @@ import MVMCore
///-----------------------------------------------------------------------------
public protocol VDSMoleculeViewProtocol: MoleculeViewProtocol, MVMCoreViewProtocol {
associatedtype ViewModel: MoleculeModelProtocol
var shouldUpdateView: Bool { get set }
var viewModel: ViewModel! { get set }
var delegateObject: MVMCoreUIDelegateObject? { get set }
var additionalData: [AnyHashable: Any]? { get set }
func viewModelDidUpdate()
func setNeedsUpdate()
}
extension VDSMoleculeViewProtocol {
@ -32,7 +34,10 @@ extension VDSMoleculeViewProtocol {
self.delegateObject = delegateObject
self.additionalData = additionalData
viewModel = castedModel
shouldUpdateView = false
viewModelDidUpdate()
shouldUpdateView = true
setNeedsUpdate()
}
public func update(viewModel: ViewModel){