more comments

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-28 18:40:10 -05:00
parent ba9e5f912f
commit 5f3c872092
12 changed files with 33 additions and 27 deletions

View File

@ -130,6 +130,7 @@ open class SelectorBase: Control, SelectorControlable {
super.updateAccessibility() super.updateAccessibility()
} }
/// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { } open func toggle() { }
} }

View File

@ -63,7 +63,7 @@ open class Checkbox: SelectorBase {
selectorColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forState: .selected) selectorColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOndark, VDSColor.elementsPrimaryOnlight, forState: .selected)
} }
/// This will checkbox the state of the Selector and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open override func toggle() { open override func toggle() {
//removed error //removed error
if showError && isSelected == false { if showError && isSelected == false {

View File

@ -38,7 +38,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
return selected return selected
} }
/// Arrary of ``CheckboxItem`` within this group. /// Array of ``CheckboxItem`` that the user will have the ability to select from.
open override var selectorViews: [CheckboxItem] { open override var selectorViews: [CheckboxItem] {
willSet { willSet {
mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
@ -54,7 +54,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
} }
} }
/// Arrary of ``CheckboxItemModel`` within this group that are selected. /// Array of ``CheckboxItemModel`` that will be used to build the selectorViews of type ``CheckboxItem``.
open var selectorModels: [CheckboxItemModel]? { open var selectorModels: [CheckboxItemModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {

View File

@ -31,13 +31,12 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Whether or not there is animation when the checkbox changes state from non-selected to a selected state. /// Whether or not there is animation when the checkbox changes state from non-selected to a selected state.
open var isAnimated: Bool = false { didSet { setNeedsUpdate() }} open var isAnimated: Bool = false { didSet { setNeedsUpdate() }}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
/// This will checkbox the state of the Selector and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open override func toggle() { open override func toggle() {
//removed error //removed error
if showError && isSelected == false { if showError && isSelected == false {

View File

@ -39,6 +39,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Array of ``RadioBoxItem`` that the user will have the ability to select from.
public override var selectorViews: [RadioBoxItem] { public override var selectorViews: [RadioBoxItem] {
willSet { willSet {
mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
@ -55,6 +56,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
} }
} }
/// Array of ``RadioBoxItemModel`` that will be used to build the selectorViews of type ``RadioBoxItem``.
open var selectorModels: [RadioBoxItemModel]? { open var selectorModels: [RadioBoxItemModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {

View File

@ -229,7 +229,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
setNeedsUpdate() setNeedsUpdate()
} }
/// This will radioBox the state of the Selector and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { open func toggle() {
//removed error //removed error
isSelected.toggle() isSelected.toggle()

View File

@ -30,9 +30,9 @@ open class RadioButton: SelectorBase {
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
open var selectedSize = CGSize(width: 10, height: 10) { didSet { setNeedsUpdate() }} private var selectorSize = CGSize(width: 10, height: 10)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
@ -58,6 +58,7 @@ open class RadioButton: SelectorBase {
} }
/// This will change the state of the Selector and execute the actionBlock if provided.
open override func toggle() { open override func toggle() {
guard !isSelected else { return } guard !isSelected else { return }
@ -90,11 +91,11 @@ open class RadioButton: SelectorBase {
layer.borderWidth = VDSFormControls.widthBorder layer.borderWidth = VDSFormControls.widthBorder
if shapeLayer == nil { if shapeLayer == nil {
let selectedBounds = selectedSize let selectedBounds = selectorSize
let bezierPath = UIBezierPath(ovalIn: CGRect(x: (bounds.width - selectedBounds.width) / 2, let bezierPath = UIBezierPath(ovalIn: CGRect(x: (bounds.width - selectedBounds.width) / 2,
y: (bounds.height - selectedBounds.height) / 2, y: (bounds.height - selectedBounds.height) / 2,
width: selectedSize.width, width: selectorSize.width,
height: selectedSize.height)) height: selectorSize.height))
let shapeLayer = CAShapeLayer() let shapeLayer = CAShapeLayer()
self.shapeLayer = shapeLayer self.shapeLayer = shapeLayer
shapeLayer.frame = bounds shapeLayer.frame = bounds
@ -107,7 +108,7 @@ open class RadioButton: SelectorBase {
// MARK: AppleGuidlinesTouchable // MARK: AppleGuidlinesTouchable
extension RadioButton: AppleGuidlinesTouchable { extension RadioButton: AppleGuidlinesTouchable {
/// Overrides to ensure that the touch point meets a minimum of 45 x 45.
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool { override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
Self.acceptablyOutsideBounds(point: point, bounds: bounds) Self.acceptablyOutsideBounds(point: point, bounds: bounds)
} }

View File

@ -42,6 +42,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// Array of ``RadioButtonItem`` that the user will have the ability to select from.
public override var selectorViews: [RadioButtonItem] { public override var selectorViews: [RadioButtonItem] {
willSet { willSet {
mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } mainStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
@ -58,6 +59,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
} }
} }
/// Array of ``RadioButtonItemModel`` that will be used to build the selectorViews of type ``RadioButtonItem``.
open var selectorModels: [RadioButtonItemModel]? { open var selectorModels: [RadioButtonItemModel]? {
didSet { didSet {
if let selectorModels { if let selectorModels {

View File

@ -29,7 +29,7 @@ open class RadioButtonItem: SelectorItemBase<RadioButton> {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Overrides // MARK: - Overrides
//-------------------------------------------------- //--------------------------------------------------
/// This will checkbox the state of the Selector and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open override func toggle() { open override func toggle() {
guard !isSelected else { return } guard !isSelected else { return }

View File

@ -51,7 +51,7 @@ open class Tabs: View {
} }
} }
//Type of behavior for Scrolling /// Type of behavior for Scrolling
public enum Overflow: String, CaseIterable { public enum Overflow: String, CaseIterable {
case scroll case scroll
case none case none
@ -86,7 +86,7 @@ open class Tabs: View {
/// A callback when the selectedIndex changes. Passes parameters (event, tabIndex). /// A callback when the selectedIndex changes. Passes parameters (event, tabIndex).
open var onTabChange: ((Int) -> Void)? open var onTabChange: ((Int) -> Void)?
//Determines the layout of the Tabs, defaults to horizontal /// Determines the layout of the Tabs, defaults to horizontal
open var orientation: Orientation = .horizontal { didSet { if oldValue != orientation { setNeedsUpdate() } } } open var orientation: Orientation = .horizontal { didSet { if oldValue != orientation { setNeedsUpdate() } } }
/// When true, Tabs will have border line. If false is passed then the border line won't be visible. /// When true, Tabs will have border line. If false is passed then the border line won't be visible.
@ -116,9 +116,10 @@ open class Tabs: View {
/// When true, Tabs will be sticky to top of page, when orientation is vertical. /// When true, Tabs will be sticky to top of page, when orientation is vertical.
open var sticky: Bool = false { didSet { setNeedsUpdate() } } open var sticky: Bool = false { didSet { setNeedsUpdate() } }
///Model of the Tabs you are wanting to show. /// Array of ``TabModel`` you are wanting to show.
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } } open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
/// Array of ``Tab`` views for the Tabs.
open var tabViews: [Tab] = [] open var tabViews: [Tab] = []
//-------------------------------------------------- //--------------------------------------------------

View File

@ -238,7 +238,7 @@ open class Toggle: Control, Changeable {
} }
} }
/// This will toggle the state of the Toggle /// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { open func toggle() {
isOn.toggle() isOn.toggle()
sendActions(for: .valueChanged) sendActions(for: .valueChanged)

View File

@ -183,7 +183,7 @@ open class ToggleView: Control, Changeable {
accessibilityLabel = "Toggle" accessibilityLabel = "Toggle"
} }
/// This will toggle the state of the Toggle and execute the actionBlock if provided. /// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { open func toggle() {
isOn.toggle() isOn.toggle()
sendActions(for: .valueChanged) sendActions(for: .valueChanged)