updated init
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
f97b08460a
commit
c00c0fb24d
@ -12,7 +12,7 @@ import Combine
|
|||||||
|
|
||||||
open class Control<ModelType: Modelable>: UIControl, ModelHandlerable, ViewProtocol, Resettable {
|
open class Control<ModelType: Modelable>: UIControl, ModelHandlerable, ViewProtocol, Resettable {
|
||||||
|
|
||||||
@Published public var model: ModelType
|
@Published public var model: ModelType = ModelType()
|
||||||
public var cancellables = Set<AnyCancellable>()
|
public var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
open func shouldUpdateView(viewModel: ModelType) -> Bool {
|
open func shouldUpdateView(viewModel: ModelType) -> Bool {
|
||||||
@ -38,25 +38,22 @@ open class Control<ModelType: Modelable>: UIControl, ModelHandlerable, ViewProto
|
|||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
required public init() {
|
required public init() {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(with model: ModelType) {
|
public required init(with model: ModelType) {
|
||||||
self.model = model
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
|
set(with: model)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
self.model = ModelType.init()
|
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import Combine
|
|||||||
|
|
||||||
open class View<ModelType: Modelable>: UIView, ModelHandlerable, ViewProtocol, Resettable {
|
open class View<ModelType: Modelable>: UIView, ModelHandlerable, ViewProtocol, Resettable {
|
||||||
|
|
||||||
@Published public var model: ModelType
|
@Published public var model: ModelType = ModelType()
|
||||||
public var cancellables = Set<AnyCancellable>()
|
public var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
open func shouldUpdateView(viewModel: ModelType) -> Bool {
|
open func shouldUpdateView(viewModel: ModelType) -> Bool {
|
||||||
@ -38,25 +38,22 @@ open class View<ModelType: Modelable>: UIView, ModelHandlerable, ViewProtocol, R
|
|||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
required public init() {
|
required public init() {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(with model: ModelType) {
|
public required init(with model: ModelType) {
|
||||||
self.model = model
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
|
set(with: model)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
self.model = ModelType.init()
|
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, Initable
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Combine Properties
|
// MARK: - Combine Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@Published public var model: ModelType
|
@Published public var model: ModelType = ModelType()
|
||||||
public var cancellables = Set<AnyCancellable>()
|
public var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -63,25 +63,22 @@ open class LabelBase<ModelType: LabelModel>: UILabel, ModelHandlerable, Initable
|
|||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
required public init() {
|
required public init() {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(with model: ModelType) {
|
public required init(with model: ModelType) {
|
||||||
self.model = model
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
self.model = ModelType()
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
|
set(with: model)
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
self.model = ModelType.init()
|
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
initialSetup()
|
initialSetup()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user