added init

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-30 14:35:52 -05:00
parent cfecae528b
commit 0b643034f6

View File

@ -8,7 +8,7 @@
import Foundation
import Combine
public protocol ModelHandlerable: AnyObject {
public protocol ModelHandlerable: AnyObject, Initable {
associatedtype ModelType: Modelable
var model: ModelType { get set }
var modelPublisher: Published<ModelType>.Publisher { get }
@ -20,6 +20,9 @@ public protocol ModelHandlerable: AnyObject {
}
extension ModelHandlerable {
public init() {
self.init(with: ModelType())
}
public func set(with model: ModelType) {
if shouldUpdateView(viewModel: model){