diff --git a/MVMCoreUI/Atoms/Views/Toggle.swift b/MVMCoreUI/Atoms/Views/Toggle.swift index 2d056d24..aff1abb3 100644 --- a/MVMCoreUI/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atoms/Views/Toggle.swift @@ -220,6 +220,18 @@ public typealias ActionBlockConfirmation = () -> (Bool) accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel") } + public override func reset() { + super.reset() + + backgroundColor = containerTintColor?.off + knobView.backgroundColor = knobTintColor?.off + isAnimated = false + isOn = false + constrainKnob() + didToggleAction = nil + shouldToggleAction = { return true } + } + class func getContainerWidth() -> CGFloat { let containerWidth = Toggle.containerSize.width return (MFSizeObject(standardSize: containerWidth, standardiPadPortraitSize: CGFloat(Toggle.containerSize.width * 1.5)))?.getValueBasedOnApplicationWidth() ?? containerWidth @@ -265,9 +277,12 @@ public typealias ActionBlockConfirmation = () -> (Bool) private func changeStateNoAnimation(_ state: Bool) { + // Hold state in case User wanted isAnimated to remain off. + let isAnimatedState = isAnimated + isAnimated = false isOn = state - isAnimated = true + isAnimated = isAnimatedState } //--------------------------------------------------