// // RadioButton.swift // VDS // // Created by Matt Bruce on 7/22/22. // import Foundation import UIKit /// Radio buttons items are single-select components through which a customer indicates a choice. /// They must always be paired with one or more other radio button items within a ``RadioButtonGroup``. /// Use radio buttons to display choices like delivery method. @objc(VDSRadioButtonItem) open class RadioButtonItem: SelectorItemBase { //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- required public init() { super.init(frame: .zero) } public override init(frame: CGRect) { super.init(frame: .zero) } public required init?(coder: NSCoder) { super.init(coder: coder) } //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- /// This will change the state of the Selector and execute the actionBlock if provided. open override func toggle() { guard !isSelected, isEnabled else { return } //removed error if showError && isSelected == false { showError.toggle() } isSelected.toggle() sendActions(for: .valueChanged) } }