didSet does not work upon init
This commit is contained in:
parent
38e9141810
commit
b8eb6cf3f4
@ -24,13 +24,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
public var style: Styler.Button.Style? {
|
public var style: Styler.Button.Style? {
|
||||||
didSet {
|
didSet {
|
||||||
guard let style = style else { return }
|
guard let style = style else { return }
|
||||||
switch style {
|
setFacade(by: style)
|
||||||
case .primary:
|
|
||||||
setPrimaryFacade()
|
|
||||||
|
|
||||||
case .secondary:
|
|
||||||
setSecondaryFacade()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public var size: Styler.Button.Size? = .standard
|
public var size: Styler.Button.Size? = .standard
|
||||||
@ -160,6 +154,17 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
disabledBorderColor_inverted = Color(uiColor: .mvmCoolGray6)
|
disabledBorderColor_inverted = Color(uiColor: .mvmCoolGray6)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setFacade(by style: Styler.Button.Style) {
|
||||||
|
|
||||||
|
switch style {
|
||||||
|
case .primary:
|
||||||
|
setPrimaryFacade()
|
||||||
|
|
||||||
|
case .secondary:
|
||||||
|
setSecondaryFacade()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -195,6 +200,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupW
|
|||||||
|
|
||||||
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style) {
|
if let style = try typeContainer.decodeIfPresent(Styler.Button.Style.self, forKey: .style) {
|
||||||
self.style = style
|
self.style = style
|
||||||
|
setFacade(by: style)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let size = try typeContainer.decodeIfPresent(Styler.Button.Size.self, forKey: .size) {
|
if let size = try typeContainer.decodeIfPresent(Styler.Button.Size.self, forKey: .size) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user