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()
}
/// This will change the state of the Selector and execute the actionBlock if provided.
open func toggle() { }
}

View File

@ -63,7 +63,7 @@ open class Checkbox: SelectorBase {
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() {
//removed error
if showError && isSelected == false {

View File

@ -38,7 +38,7 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
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] {
willSet {
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]? {
didSet {
if let selectorModels {

View File

@ -31,13 +31,12 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
// MARK: - Public Properties
//--------------------------------------------------
/// 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() }}
//--------------------------------------------------
// 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() {
//removed error
if showError && isSelected == false {

View File

@ -39,6 +39,7 @@ open class RadioBoxGroup: SelectorGroupSelectedHandlerBase<RadioBoxItem> {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
/// Array of ``RadioBoxItem`` that the user will have the ability to select from.
public override var selectorViews: [RadioBoxItem] {
willSet {
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]? {
didSet {
if let selectorModels {

View File

@ -229,7 +229,7 @@ open class RadioBoxItem: Control, Changeable, FormFieldable {
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() {
//removed error
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
@ -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() {
guard !isSelected else { return }
@ -90,11 +91,11 @@ open class RadioButton: SelectorBase {
layer.borderWidth = VDSFormControls.widthBorder
if shapeLayer == nil {
let selectedBounds = selectedSize
let selectedBounds = selectorSize
let bezierPath = UIBezierPath(ovalIn: CGRect(x: (bounds.width - selectedBounds.width) / 2,
y: (bounds.height - selectedBounds.height) / 2,
width: selectedSize.width,
height: selectedSize.height))
width: selectorSize.width,
height: selectorSize.height))
let shapeLayer = CAShapeLayer()
self.shapeLayer = shapeLayer
shapeLayer.frame = bounds
@ -107,7 +108,7 @@ open class RadioButton: SelectorBase {
// MARK: 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 {
Self.acceptablyOutsideBounds(point: point, bounds: bounds)
}

View File

@ -42,6 +42,7 @@ open class RadioButtonGroup: SelectorGroupSelectedHandlerBase<RadioButtonItem> {
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
/// Array of ``RadioButtonItem`` that the user will have the ability to select from.
public override var selectorViews: [RadioButtonItem] {
willSet {
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]? {
didSet {
if let selectorModels {

View File

@ -29,7 +29,7 @@ open class RadioButtonItem: SelectorItemBase<RadioButton> {
//--------------------------------------------------
// 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() {
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 {
case scroll
case none
@ -86,39 +86,40 @@ open class Tabs: View {
/// A callback when the selectedIndex changes. Passes parameters (event, tabIndex).
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() } } }
///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.
open var borderLine: Bool = true { didSet { setNeedsUpdate() } }
///It will fill the Tabs to the width of the compoent and all Tabs will be in equal width when orientation is horizontal. This is recommended when there are no more than 2-3 tabs.
/// It will fill the Tabs to the width of the compoent and all Tabs will be in equal width when orientation is horizontal. This is recommended when there are no more than 2-3 tabs.
open var fillContainer: Bool = false { didSet { setNeedsUpdate() } }
///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 indicatorFillTab: Bool = false { didSet { setNeedsUpdate() } }
///Sets the Position of the Selected/Hover Border Accent for All Tabs, only for Horizontal Orientation
/// Sets the Position of the Selected/Hover Border Accent for All Tabs, only for Horizontal Orientation
open var indicatorPosition: IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
///Minimum Width for All Tabs, when orientation is horizontal.
/// Minimum Width for All Tabs, when orientation is horizontal.
open var minWidth: CGFloat = 44.0 { didSet { setNeedsUpdate() } }
///If set to 'scroll', Tabs can be overflow and scrollable. With 'none', tabs will not overflow and labels will be wrapped to multiple lines if the label text is long.
/// If set to 'scroll', Tabs can be overflow and scrollable. With 'none', tabs will not overflow and labels will be wrapped to multiple lines if the label text is long.
open var overflow: Overflow = .scroll { didSet { setNeedsUpdate() } }
///The initial Selected Tab's index and is set once a Tab is clicked
/// The initial Selected Tab's index and is set once a Tab is clicked
open var selectedIndex: Int = 0 { didSet { setNeedsUpdate() } }
///Determines the size of the Tabs TextStyle
/// Determines the size of the Tabs TextStyle
open var size: Size = .medium { didSet { setNeedsUpdate() } }
///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() } }
///Model of the Tabs you are wanting to show.
/// Array of ``TabModel`` you are wanting to show.
open var tabModels: [TabModel] = [] { didSet { updateTabItems() } }
/// Array of ``Tab`` views for the Tabs.
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() {
isOn.toggle()
sendActions(for: .valueChanged)

View File

@ -183,7 +183,7 @@ open class ToggleView: Control, Changeable {
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() {
isOn.toggle()
sendActions(for: .valueChanged)