From ff0cf0ddbb7be021dcd348af09a9bebfc9496858 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 25 Aug 2023 15:37:53 -0500 Subject: [PATCH] updated for enabling Signed-off-by: Matt Bruce --- VDS/Components/Buttons/Button/ButtonBase.swift | 16 +++------------- .../Buttons/ButtonGroup/ButtonGroup.swift | 14 +------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/VDS/Components/Buttons/Button/ButtonBase.swift b/VDS/Components/Buttons/Button/ButtonBase.swift index 2f1e23b5..8142b4da 100644 --- a/VDS/Components/Buttons/Button/ButtonBase.swift +++ b/VDS/Components/Buttons/Button/ButtonBase.swift @@ -11,7 +11,7 @@ import VDSColorTokens import VDSFormControlsTokens import Combine -public protocol Buttonable: UIControl, Surfaceable, Disabling { +public protocol Buttonable: UIControl, Surfaceable, Enabling { var availableSizes: [ButtonSize] { get } var text: String? { get set } var intrinsicContentSize: CGSize { get } @@ -83,17 +83,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab } } } - - /// Whether this object is disabled or not - open var disabled: Bool { - get { !isEnabled } - set { - if !isEnabled != newValue { - isEnabled = !newValue - } - } - } - + /// Whether the Control is enabled or not. open override var isEnabled: Bool { didSet { setNeedsUpdate(); isUserInteractionEnabled = isEnabled } } @@ -144,7 +134,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab open func reset() { shouldUpdateView = false surface = .light - disabled = false + isEnabled = true text = nil accessibilityCustomActions = [] shouldUpdateView = true diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift index 61035c31..ae2c53a8 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift @@ -94,21 +94,9 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega // MARK: - Overrides //-------------------------------------------------- /// Whether this object is disabled or not - override open var disabled: Bool { - didSet { - buttons.forEach { button in - var b = button - b.disabled = disabled - } - } - } - override open var isEnabled: Bool { didSet { - buttons.forEach { button in - var b = button - b.isEnabled = isEnabled - } + buttons.forEach { $0.isEnabled = isEnabled } } }