// // Modelable.swift // VDS // // Created by Matt Bruce on 7/22/22. // import Foundation public protocol ModelHandlerable: AnyObject { associatedtype ModelType: Modelable var model: ModelType { get set } init(with model: ModelType) func set(with model: ModelType) func shouldUpdateView(viewModel: ModelType) -> Bool func updateView(viewModel: ModelType) } extension ModelHandlerable { public func set(with model: ModelType) { if shouldUpdateView(viewModel: model){ updateView(viewModel: model) self.model = model } } }