diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index eab07e0f..8efd0a3c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -207,6 +207,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) layer.cornerRadius = Self.getContainerHeight() / 2.0 knobView.layer.cornerRadius = Self.getKnobHeight() / 2.0 + + changeStateNoAnimation(isOn) } public override func setupView() { @@ -245,8 +247,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) backgroundColor = containerTintColor.off knobView.backgroundColor = knobTintColor.off isAnimated = true - isOn = false - constrainKnob() didToggleAction = nil shouldToggleAction = { return true } } @@ -368,7 +368,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) containerTintColor.off = model.offTintColor.uiColor knobTintColor.on = model.onKnobTintColor.uiColor knobTintColor.off = model.offKnobTintColor.uiColor - changeStateNoAnimation(model.state) + isOn = model.state + changeStateNoAnimation(isOn) isAnimated = model.animated isEnabled = model.enabled