From 5a3f04aa5f78a9fdcf0a937c6e5df96a0497b548 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 2 Aug 2024 08:53:15 -0500 Subject: [PATCH] use super instead of var Signed-off-by: Matt Bruce --- .../Atomic/Atoms/Selectors/Checkbox.swift | 24 +++++-------------- .../Atomic/Atoms/Views/CheckboxLabel.swift | 22 ++++------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift index 82aad9ee..205b8dfb 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/Checkbox.swift @@ -38,20 +38,10 @@ import VDS } } - /// Disables all selection logic when setting the value of isSelected, reducing it to a stored property. - open var updateSelectionOnly: Bool = false - - /** - The represented state of the Checkbox. - - Setting updateSelectionOnly to true bypasses the animation logic inherent with setting this property. - */ override open var isSelected: Bool { didSet { - if !updateSelectionOnly { - viewModel.selected = isSelected - _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) - } + viewModel.selected = isSelected + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) } } @@ -144,12 +134,10 @@ import VDS isEnabled = viewModel.enabled && !viewModel.readOnly isAnimated = viewModel.animated - if viewModel.selected { - updateSelectionOnly = true - isSelected = viewModel.selected - updateSelectionOnly = false - } - + //call super here to go around the didSet + //in this class + super.isSelected = viewModel.selected + //events viewModel.updateUI = { MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift index 19966009..bc200203 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift @@ -19,21 +19,11 @@ import VDS var fieldKey: String? var fieldValue: JSONValue? var groupName: String? - - /// Disables all selection logic when setting the value of isSelected, reducing it to a stored property. - open var updateSelectionOnly: Bool = false - /** - The represented state of the Checkbox. - - Setting updateSelectionOnly to true bypasses the animation logic inherent with setting this property. - */ override open var isSelected: Bool { didSet { - if !updateSelectionOnly { - viewModel.checkbox.selected = isSelected - _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) - } + viewModel.checkbox.selected = isSelected + _ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) } } @@ -76,11 +66,9 @@ import VDS isAnimated = viewModel.checkbox.animated isEnabled = viewModel.checkbox.enabled && !viewModel.checkbox.readOnly - if viewModel.checkbox.selected { - updateSelectionOnly = false - isSelected = viewModel.checkbox.selected - updateSelectionOnly = true - } + //call super here to go around the didSet + //in this class + super.isSelected = viewModel.checkbox.selected //events viewModel.checkbox.updateUI = {