diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Toggle.swift index 30bcd85a..c268158c 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Toggle.swift @@ -109,22 +109,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- - public func updateView(_ size: CGFloat) { } - - public override func setup() { - super.setup() - - bridge_accessibilityHintBlock = { [weak self] in - guard let self else { return nil } - return MVMCoreUIUtility.hardcodedString(withKey: isEnabled ? "AccToggleHint" : "AccDisabled") - } - - bridge_accessibilityValueBlock = { [weak self] in - guard let self else { return nil } - return isOn ? MVMCoreUIUtility.hardcodedString(withKey: "AccOn") : MVMCoreUIUtility.hardcodedString(withKey: "AccOff") - } - } - public override func reset() { super.reset() accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "Toggle_buttonlabel") @@ -132,21 +116,6 @@ public typealias ActionBlockConfirmation = () -> (Bool) shouldToggleAction = { return true } } - //-------------------------------------------------- - // MARK: - Actions - //-------------------------------------------------- - /// This will toggle the state of the Toggle and execute the actionBlock if provided. - public func toggleAndAction() { - toggle() - } - - open override func toggle() { - if let result = shouldToggleAction?(), result { - super.toggle() - } - } - - // MARK:- MoleculeViewProtocol public func viewModelDidUpdate() { FormValidator.setupValidation(for: viewModel, delegate: delegateObject?.formHolderDelegate) @@ -185,7 +154,27 @@ public typealias ActionBlockConfirmation = () -> (Bool) } } } + + //-------------------------------------------------- + // MARK: - Actions + //-------------------------------------------------- + /// This will toggle the state of the Toggle and execute the actionBlock if provided. + public func toggleAndAction() { + toggle() + } + open override func toggle() { + if let result = shouldToggleAction?(), result { + super.toggle() + } + } + + //-------------------------------------------------- + // MARK:- MoleculeViewProtocol + //-------------------------------------------------- + + public func updateView(_ size: CGFloat) {} + public class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return Self().intrinsicContentSize.height }