diff --git a/VDS/Classes/Control.swift b/VDS/Classes/Control.swift index cad40596..b9a1baea 100644 --- a/VDS/Classes/Control.swift +++ b/VDS/Classes/Control.swift @@ -16,7 +16,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { //-------------------------------------------------- // MARK: - Combine Properties //-------------------------------------------------- - /// Set of Subscribers for any Publishers for this Control. open var subscribers = Set() open var onClickSubscriber: AnyCancellable? { @@ -32,12 +31,10 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { //-------------------------------------------------- private var initialSetupPerformed = false - /// Key of whether or not updateView() is called in setNeedsUpdate() open var shouldUpdateView: Bool = true open var userInfo = [String: Primitive]() - /// Current Surface and this is used to pass down to child objects that implement Surfacable open var surface: Surface = .light { didSet { setNeedsUpdate() } } /// Whether the Control is selected or not. @@ -50,7 +47,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { var isHighlightAnimating = false - /// Whether the Control is highlighted or not.. + /// Whether the Control is highlighted or not. open override var isHighlighted: Bool { didSet { if canHighlight && isHighlightAnimating == false && touchUpInsideCount > 0 { @@ -113,7 +110,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { insetsLayoutMarginsFromSafeArea = false } - /// Function used to make changes to the View based off a change events or from local properties. open func updateView() { } open func updateAccessibility() { @@ -131,7 +127,6 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { } - /// Resets to default settings. open func reset() { backgroundColor = .clear surface = .light diff --git a/VDS/Classes/SelectorBase.swift b/VDS/Classes/SelectorBase.swift index cb520876..2c9bb03e 100644 --- a/VDS/Classes/SelectorBase.swift +++ b/VDS/Classes/SelectorBase.swift @@ -11,10 +11,19 @@ import VDSColorTokens import VDSFormControlsTokens public protocol SelectorControlable: Control, Changeable { + /// Whether not to show the error. var showError: Bool { get set } + + /// Size of the SelectorView. var size: CGSize { get set } + + /// Configuration for the Background Color based on Control State. var backgroundColorConfiguration: ControlColorConfiguration { get set } + + /// Configuration for the Border Color based on Control State. var borderColorConfiguration: ControlColorConfiguration { get set } + + /// Configuration for the Selector Color based on Control State. var selectorColorConfiguration: ControlColorConfiguration { get set } } @@ -41,6 +50,7 @@ open class SelectorBase: Control, SelectorControlable { } } + /// Override UIControl state to add the .error state if showError is true. open override var state: UIControl.State { get { var state = super.state @@ -68,6 +78,7 @@ open class SelectorBase: Control, SelectorControlable { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { size } open override func initialSetup() { @@ -77,6 +88,7 @@ open class SelectorBase: Control, SelectorControlable { } } + /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() @@ -84,13 +96,14 @@ open class SelectorBase: Control, SelectorControlable { accessibilityTraits = .button } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() setNeedsLayout() layoutIfNeeded() } + /// Used to update any Accessibility properties.ß open override func updateAccessibility() { super.updateAccessibility() } diff --git a/VDS/Classes/SelectorGroupHandlerBase.swift b/VDS/Classes/SelectorGroupHandlerBase.swift index 5d858bde..2caba743 100644 --- a/VDS/Classes/SelectorGroupHandlerBase.swift +++ b/VDS/Classes/SelectorGroupHandlerBase.swift @@ -19,7 +19,6 @@ open class SelectorGroupHandlerBase: Control, Changeable { /// Array of the HandlerType registered. open var selectorViews: [HandlerType] = [] - /// The primary subscriber for onChange or the UIControl valueChanged event. open var onChangeSubscriber: AnyCancellable? { willSet { if let onChangeSubscriber { @@ -28,14 +27,13 @@ open class SelectorGroupHandlerBase: Control, Changeable { } } - /// Whether this object is enabled or not override open var isEnabled: Bool { didSet { selectorViews.forEach { $0.isEnabled = isEnabled } } } - /// Current Surface and this is used to pass down to child objects that implement Surfacable. + ///The background tint that the component will be placed on. This will automatically adjust other elements as needed and takes “light” or “dark” override open var surface: Surface { didSet { selectorViews.forEach { handler in @@ -61,12 +59,13 @@ open class SelectorGroupHandlerBase: Control, Changeable { } } - /// Resets to default settings as well as child views. + /// Resets to default settings. open override func reset() { super.reset() selectorViews.forEach{ $0.reset() } } + /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() setAccessibilityLabel(for: selectorViews) diff --git a/VDS/Classes/SelectorItemBase.swift b/VDS/Classes/SelectorItemBase.swift index e7942bdb..43deef15 100644 --- a/VDS/Classes/SelectorItemBase.swift +++ b/VDS/Classes/SelectorItemBase.swift @@ -62,7 +62,6 @@ open class SelectorItemBase: Control, Errorable, //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - /// Subscriber that is set for the .valueChanged event. open var onChangeSubscriber: AnyCancellable? { willSet { if let onChangeSubscriber { @@ -95,7 +94,6 @@ open class SelectorItemBase: Control, Errorable, /// Generic Object used to allow the user to 'Select'. open var selectorView = Selector() - /// Whether or not ths Item is selected. open override var isSelected: Bool { didSet { setNeedsUpdate() }} /// Text shown in the label. @@ -167,6 +165,7 @@ open class SelectorItemBase: Control, Errorable, } } + /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() @@ -184,7 +183,7 @@ open class SelectorItemBase: Control, Errorable, mainStackView.pinToSuperView() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() updateLabels() @@ -195,6 +194,7 @@ open class SelectorItemBase: Control, Errorable, selectorView.surface = surface } + /// Used to update any Accessibility properties. open override func updateAccessibility() { super.updateAccessibility() setAccessibilityLabel(for: [label, childLabel, errorLabel]) diff --git a/VDS/Classes/SelfSizingCollectionView.swift b/VDS/Classes/SelfSizingCollectionView.swift index d42e30f9..e5d1948d 100644 --- a/VDS/Classes/SelfSizingCollectionView.swift +++ b/VDS/Classes/SelfSizingCollectionView.swift @@ -36,7 +36,7 @@ public final class SelfSizingCollectionView: UICollectionView { // MARK: - UIView //-------------------------------------------------- - + /// The natural size for the receiving view, considering only properties of the view itself. public override var intrinsicContentSize: CGSize { let contentSize = self.contentSize //print(#function, contentSize) diff --git a/VDS/Classes/View.swift b/VDS/Classes/View.swift index e66a7448..faa2b644 100644 --- a/VDS/Classes/View.swift +++ b/VDS/Classes/View.swift @@ -16,7 +16,6 @@ open class View: UIView, ViewProtocol, UserInfoable { //-------------------------------------------------- // MARK: - Combine Properties //-------------------------------------------------- - /// Set of Subscribers for any Publishers for this Control. open var subscribers = Set() //-------------------------------------------------- @@ -24,16 +23,13 @@ open class View: UIView, ViewProtocol, UserInfoable { //-------------------------------------------------- private var initialSetupPerformed = false - /// Key of whether or not updateView() is called in setNeedsUpdate() open var shouldUpdateView: Bool = true /// Dictionary for keeping information for this Control use only Primitives. open var userInfo = [String: Primitive]() - /// Current Surface and this is used to pass down to child objects that implement Surfacable open var surface: Surface = .light { didSet { setNeedsUpdate() } } - /// Whether the View is enabled or not. open var isEnabled: Bool = true { didSet { setNeedsUpdate() } } //-------------------------------------------------- @@ -67,18 +63,14 @@ open class View: UIView, ViewProtocol, UserInfoable { } } - /// Will be called only once and should be overridden in subclasses to setup UI or defaults. open func setup() { backgroundColor = .clear translatesAutoresizingMaskIntoConstraints = false insetsLayoutMarginsFromSafeArea = false } - /// Function used to make changes to the View based off a change events or from local properties.. - open func updateView() { - } + open func updateView() { } - /// Used to update any Accessibility properties. open func updateAccessibility() { if isEnabled { accessibilityTraits.remove(.notEnabled) @@ -87,7 +79,6 @@ open class View: UIView, ViewProtocol, UserInfoable { } } - /// Resets to default settings. open func reset() { backgroundColor = .clear surface = .light diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index ef7569fb..59820006 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -144,7 +144,7 @@ open class Badge: View { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index c71b4f31..7ef2edbb 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -306,7 +306,7 @@ open class BadgeIndicator: View { } } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Buttons/Button/Button.swift b/VDS/Components/Buttons/Button/Button.swift index b91f1a5c..85cab228 100644 --- a/VDS/Components/Buttons/Button/Button.swift +++ b/VDS/Components/Buttons/Button/Button.swift @@ -50,6 +50,7 @@ open class Button: ButtonBase, Useable { textColorConfiguration.getColor(self) } + /// TextStyle used on the titleLabel. open override var textStyle: TextStyle { size == .large ? TextStyle.boldBodyLarge : TextStyle.boldBodySmall } @@ -121,7 +122,7 @@ open class Button: ButtonBase, Useable { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open override func setup() { @@ -144,6 +145,7 @@ open class Button: ButtonBase, Useable { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { guard let width, width > 0 else { var superSize = super.intrinsicContentSize @@ -154,7 +156,7 @@ open class Button: ButtonBase, Useable { return CGSize(width: width > size.minimumWidth ? width : size.minimumWidth, height: size.height) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Buttons/Button/ButtonBase.swift b/VDS/Components/Buttons/Button/ButtonBase.swift index d8c3add4..35daa8c3 100644 --- a/VDS/Components/Buttons/Button/ButtonBase.swift +++ b/VDS/Components/Buttons/Button/ButtonBase.swift @@ -12,8 +12,14 @@ import VDSFormControlsTokens import Combine public protocol Buttonable: UIControl, Surfaceable, Enabling { + + /// The ButtonSize available to this type of Buttonable. var availableSizes: [ButtonSize] { get } + + /// The Text that will show up in the TitleLabel for this Buttonable. var text: String? { get set } + + /// The natural size for the receiving view, considering only properties of the view itself. var intrinsicContentSize: CGSize { get } } @@ -51,16 +57,23 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab open var shouldUpdateView: Bool = true open var availableSizes: [ButtonSize] { [] } + + open var surface: Surface = .light { didSet { setNeedsUpdate() }} open var text: String? { didSet { setNeedsUpdate() } } + /// Array of LabelAttributeModel objects used in rendering the text. open var textAttributes: [any LabelAttributeModel]? { nil } + + /// TextStyle used on the titleLabel. + open var textStyle: TextStyle { .defaultStyle } + + /// UIColor used on the titleLabel text. + open var textColor: UIColor { .black } + /// Will determine if a scaled font should be used for the titleLabel font. open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }} - - /// Current Surface and this is used to pass down to child objects that implement Surfacable - open var surface: Surface = .light { didSet { setNeedsUpdate() }} - + open var userInfo = [String: Primitive]() open var touchUpInsideCount: Int = 0 @@ -87,10 +100,6 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab /// Whether the Control is enabled or not. open override var isEnabled: Bool { didSet { setNeedsUpdate() } } - open var textStyle: TextStyle { .defaultStyle } - - open var textColor: UIColor { .black } - //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -110,7 +119,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open func initialSetup() { if !initialSetupPerformed { @@ -151,7 +160,7 @@ open class ButtonBase: UIButton, Buttonable, ViewProtocol, UserInfoable, Clickab return CGSize(width: adjustedWidth, height: adjustedHeight) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open func updateView() { updateLabel() } diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift index e0db8b10..3b71f6f9 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift @@ -125,7 +125,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega super.init(coder: coder) } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open override func setup() { @@ -137,7 +137,7 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() positionLayout.position = buttonPosition diff --git a/VDS/Components/Buttons/TextLink/TextLink.swift b/VDS/Components/Buttons/TextLink/TextLink.swift index 8b6ea74b..48480f29 100644 --- a/VDS/Components/Buttons/TextLink/TextLink.swift +++ b/VDS/Components/Buttons/TextLink/TextLink.swift @@ -34,6 +34,7 @@ open class TextLink: ButtonBase { size == .large ? TextStyle.bodyLarge : TextStyle.bodySmall } + /// UIColor used on the titleLabel text. open override var textColor: UIColor { textColorConfiguration.getColor(self) } @@ -69,7 +70,7 @@ open class TextLink: ButtonBase { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open override func setup() { super.setup() @@ -103,11 +104,12 @@ open class TextLink: ButtonBase { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { //need to set the properties so the super class //can render out the label correctly diff --git a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift index 2e75e6a3..61fa5b5d 100644 --- a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift +++ b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift @@ -46,6 +46,7 @@ open class TextLinkCaret: ButtonBase { 44 } + /// UIColor used on the titleLabel text. open override var textColor: UIColor { textColorConfiguration.getColor(self) } @@ -72,7 +73,7 @@ open class TextLinkCaret: ButtonBase { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open override func setup() { super.setup() @@ -89,12 +90,13 @@ open class TextLinkCaret: ButtonBase { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. override open var intrinsicContentSize: CGSize { //get the labels size, if not the button return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { imageAttribute = CaretLabelAttribute(tintColor: textColor, position: iconPosition) super.updateView() diff --git a/VDS/Components/Checkbox/CheckboxGroup.swift b/VDS/Components/Checkbox/CheckboxGroup.swift index c5cd4d9e..151a8d1a 100644 --- a/VDS/Components/Checkbox/CheckboxGroup.swift +++ b/VDS/Components/Checkbox/CheckboxGroup.swift @@ -120,8 +120,10 @@ extension CheckboxGroup { public var value: AnyHashable? public var accessibileText: String? public var labelText: String? + /// Array of LabelAttributeModel objects used in rendering the labeText. public var labelTextAttributes: [any LabelAttributeModel]? public var childText: String? + /// Array of LabelAttributeModel objects used in rendering the childText. public var childTextAttributes: [any LabelAttributeModel]? public var selected: Bool public var showError: Bool diff --git a/VDS/Components/Checkbox/CheckboxItem.swift b/VDS/Components/Checkbox/CheckboxItem.swift index 994eca5e..c8e6380e 100644 --- a/VDS/Components/Checkbox/CheckboxItem.swift +++ b/VDS/Components/Checkbox/CheckboxItem.swift @@ -44,7 +44,7 @@ open class CheckboxItem: SelectorItemBase { sendActions(for: .valueChanged) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { selectorView.isAnimated = isAnimated super.updateView() diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 63e8000a..bcb194ac 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -263,7 +263,7 @@ open class ButtonIcon: Control { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Icon/Icon.swift b/VDS/Components/Icon/Icon.swift index 58a515db..d466c627 100644 --- a/VDS/Components/Icon/Icon.swift +++ b/VDS/Components/Icon/Icon.swift @@ -71,11 +71,12 @@ open class Icon: View { imageView.image = nil } + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { dimensions } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() //get the color for the image diff --git a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift index 7cc2f224..081b3877 100644 --- a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift @@ -52,7 +52,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel { } //-------------------------------------------------- - // MARK: - Private Functions + // MARK: - Private Methods //-------------------------------------------------- private func imageAttachment(image: UIImage) -> NSTextAttachment { let attachment = NSTextAttachment() @@ -70,7 +70,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- public func getAttachment() throws -> NSTextAttachment { diff --git a/VDS/Components/Label/Attributes/LabelAttributeModel.swift b/VDS/Components/Label/Attributes/LabelAttributeModel.swift index a065b2b7..84fdc005 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeModel.swift +++ b/VDS/Components/Label/Attributes/LabelAttributeModel.swift @@ -9,12 +9,19 @@ import Foundation import UIKit public protocol LabelAttributeModel: AnyEquatable, Withable, Equatable, Identifiable where ID == UUID { + /// Position of the starting point for this LabelAttribute. var location: Int { get set } + + /// Length from the location. var length: Int { get set } + + /// Applies the attribute to the attributedString that is given. + /// - Parameter attributedString: AttributedString that the attributed is applied. func setAttribute(on attributedString: NSMutableAttributedString) } extension LabelAttributeModel { + /// Range for this AttributeModel public var range: NSRange { NSRange(location: location, length: length) } diff --git a/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift b/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift index c58945a6..0ca4e2f9 100644 --- a/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/UnderlineLabelAttribute.swift @@ -50,7 +50,7 @@ public struct UnderlineLabelAttribute: LabelAttributeModel { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- public func setAttribute(on attributedString: NSMutableAttributedString) { attributedString.addAttribute(.underlineStyle, value: underlineValue.rawValue, range: range) diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index dc69bfea..16c676d4 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -34,8 +34,10 @@ open class Label: UILabel, ViewProtocol, UserInfoable { /// Current Surface and this is used to pass down to child objects that implement Surfacable open var surface: Surface = .light { didSet { setNeedsUpdate() }} + /// Array of LabelAttributeModel objects used in rendering the text. open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} + /// TextStyle used on the this label. open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }} open var edgeInsets: UIEdgeInsets { textStyle.edgeInsets } @@ -85,7 +87,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- open func initialSetup() { if !initialSetupPerformed { @@ -135,7 +137,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open func updateView() { if !useAttributedText { if let text = text { diff --git a/VDS/Components/Line/Line.swift b/VDS/Components/Line/Line.swift index e64e7406..60f76dcb 100644 --- a/VDS/Components/Line/Line.swift +++ b/VDS/Components/Line/Line.swift @@ -43,6 +43,7 @@ open class Line: View { // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { if orientation == .vertical { return .init(width: 1, height: bounds.height) @@ -62,7 +63,7 @@ open class Line: View { super.setup() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Loader/Loader.swift b/VDS/Components/Loader/Loader.swift index 9fd4e4e3..ecd75b0f 100644 --- a/VDS/Components/Loader/Loader.swift +++ b/VDS/Components/Loader/Loader.swift @@ -34,6 +34,7 @@ open class Loader: View { } } + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { .init(width: size, height: size) } //-------------------------------------------------- @@ -55,7 +56,7 @@ open class Loader: View { ]) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() icon.color = iconColorConfiguration.getColor(self) diff --git a/VDS/Components/Loader/LoaderViewController.swift b/VDS/Components/Loader/LoaderViewController.swift index d64e7a74..32c6ef3e 100644 --- a/VDS/Components/Loader/LoaderViewController.swift +++ b/VDS/Components/Loader/LoaderViewController.swift @@ -43,7 +43,7 @@ open class LoaderViewController: UIViewController, Surfaceable { updateView() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open func updateView() { view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.8) if let size { diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index 3e704b5e..7f8f630d 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -264,7 +264,7 @@ open class Notification: View { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/RadioBox/RadioBoxGroup.swift b/VDS/Components/RadioBox/RadioBoxGroup.swift index 2443bc74..f11b7acb 100644 --- a/VDS/Components/RadioBox/RadioBoxGroup.swift +++ b/VDS/Components/RadioBox/RadioBoxGroup.swift @@ -115,10 +115,13 @@ extension RadioBoxGroup { public var value: AnyHashable? public var accessibileText: String? public var text: String + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var subText: String? + /// Array of LabelAttributeModel objects used in rendering the subText. public var subTextAttributes: [any LabelAttributeModel]? public var subTextRight: String? + /// Array of LabelAttributeModel objects used in rendering the subTextRight. public var subTextRightAttributes: [any LabelAttributeModel]? public var selected: Bool diff --git a/VDS/Components/RadioBox/RadioBoxItem.swift b/VDS/Components/RadioBox/RadioBoxItem.swift index b9f16b5e..2ce7edba 100644 --- a/VDS/Components/RadioBox/RadioBoxItem.swift +++ b/VDS/Components/RadioBox/RadioBoxItem.swift @@ -88,6 +88,7 @@ open class RadioBoxItem: Control, Changeable { open var text: String = "Default Text" { didSet { setNeedsUpdate() }} + /// Array of LabelAttributeModel objects used in rendering the text. open var textAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} open var textAttributedText: NSAttributedString? { @@ -100,6 +101,7 @@ open class RadioBoxItem: Control, Changeable { open var subText: String? { didSet { setNeedsUpdate() }} + /// Array of LabelAttributeModel objects used in rendering the subText. open var subTextAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} open var subTextAttributedText: NSAttributedString? { @@ -112,6 +114,7 @@ open class RadioBoxItem: Control, Changeable { open var subTextRight: String? { didSet { setNeedsUpdate() }} + /// Array of LabelAttributeModel objects used in rendering the subTextRight. open var subTextRightAttributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }} open var subTextRightAttributedText: NSAttributedString? { @@ -259,7 +262,7 @@ open class RadioBoxItem: Control, Changeable { sendActions(for: .valueChanged) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/RadioButton/RadioButtonGroup.swift b/VDS/Components/RadioButton/RadioButtonGroup.swift index 90e8bba7..ef86ac6c 100644 --- a/VDS/Components/RadioButton/RadioButtonGroup.swift +++ b/VDS/Components/RadioButton/RadioButtonGroup.swift @@ -124,8 +124,10 @@ extension RadioButtonGroup { public var value: AnyHashable? public var accessibileText: String? public var labelText: String? + /// Array of LabelAttributeModel objects used in rendering the labelText. public var labelTextAttributes: [any LabelAttributeModel]? public var childText: String? + /// Array of LabelAttributeModel objects used in rendering the childText. public var childTextAttributes: [any LabelAttributeModel]? public var selected: Bool public var showError: Bool diff --git a/VDS/Components/RadioSwatch/RadioSwatch.swift b/VDS/Components/RadioSwatch/RadioSwatch.swift index 9f61b4ec..18a2e866 100644 --- a/VDS/Components/RadioSwatch/RadioSwatch.swift +++ b/VDS/Components/RadioSwatch/RadioSwatch.swift @@ -125,7 +125,7 @@ open class RadioSwatch: Control { sendActions(for: .valueChanged) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift index 98cc0d44..d4d24fa6 100644 --- a/VDS/Components/RadioSwatch/RadioSwatchGroup.swift +++ b/VDS/Components/RadioSwatch/RadioSwatchGroup.swift @@ -124,7 +124,7 @@ open class RadioSwatchGroup: SelectorGroupSelectedHandlerBase, UICo collectionView.dataSource = self } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tabs/Tab.swift b/VDS/Components/Tabs/Tab.swift index 16a39935..a5b06a48 100644 --- a/VDS/Components/Tabs/Tab.swift +++ b/VDS/Components/Tabs/Tab.swift @@ -50,6 +50,7 @@ extension Tabs { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- + /// TextStyle used on the label. private var textStyle: TextStyle { if size == .medium { return .boldBodyLarge @@ -145,7 +146,7 @@ extension Tabs { labelBottomConstraint = label.pinBottom(anchor: layoutGuide.bottomAnchor, priority: .defaultHigh) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tabs/Tabs.swift b/VDS/Components/Tabs/Tabs.swift index cd138d60..6c4c4462 100644 --- a/VDS/Components/Tabs/Tabs.swift +++ b/VDS/Components/Tabs/Tabs.swift @@ -201,7 +201,7 @@ open class Tabs: View { } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tabs/TabsContainer.swift b/VDS/Components/Tabs/TabsContainer.swift index 0b8db53d..9abc1f0b 100644 --- a/VDS/Components/Tabs/TabsContainer.swift +++ b/VDS/Components/Tabs/TabsContainer.swift @@ -135,7 +135,7 @@ open class TabsContainer: View { tabMenuLayoutGuide.pinToSuperView() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/TextFields/EntryField/EntryField.swift b/VDS/Components/TextFields/EntryField/EntryField.swift index 933d53ee..86e6fd5b 100644 --- a/VDS/Components/TextFields/EntryField/EntryField.swift +++ b/VDS/Components/TextFields/EntryField/EntryField.swift @@ -135,6 +135,7 @@ open class EntryField: Control, Changeable { open var showError: Bool = false { didSet { setNeedsUpdate() }} + /// Override UIControl state to add the .error state if showError is true. open override var state: UIControl.State { get { var state = super.state @@ -258,7 +259,7 @@ open class EntryField: Control, Changeable { readOnly = false } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index eb7ca72a..a7260b02 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -75,6 +75,7 @@ open class InputField: EntryField, UITextFieldDelegate { } } + /// Override UIControl state to add the .error state if showSuccess is true and if showError is true. open override var state: UIControl.State { get { var state = super.state @@ -161,7 +162,7 @@ open class InputField: EntryField, UITextFieldDelegate { return inputFieldStackView } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index 6d94399f..a9843dad 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -91,7 +91,7 @@ open class TextArea: EntryField { return inputFieldStackView } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 45a6dbaf..0050630d 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -200,7 +200,7 @@ open class TileContainer: Control { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() @@ -249,7 +249,7 @@ open class TileContainer: Control { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- public func addContentView(_ view: UIView, shouldPin: Bool = true) { containerView.addSubview(view) @@ -281,7 +281,7 @@ open class TileContainer: Control { } //-------------------------------------------------- - // MARK: - Private Functions + // MARK: - Private Methods //-------------------------------------------------- private func ratioSize(for width: CGFloat) -> CGSize { var height: CGFloat = width diff --git a/VDS/Components/Tilelet/Tilelet.swift b/VDS/Components/Tilelet/Tilelet.swift index 0de18f58..218b037b 100644 --- a/VDS/Components/Tilelet/Tilelet.swift +++ b/VDS/Components/Tilelet/Tilelet.swift @@ -365,7 +365,7 @@ open class Tilelet: TileContainer { } } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tilelet/TileletSubTitleModel.swift b/VDS/Components/Tilelet/TileletSubTitleModel.swift index 0d9f01f6..2a2c7c6f 100644 --- a/VDS/Components/Tilelet/TileletSubTitleModel.swift +++ b/VDS/Components/Tilelet/TileletSubTitleModel.swift @@ -24,6 +24,7 @@ extension Tilelet { //-------------------------------------------------- public var text: String = "" public var standardStyle: StandardStyle = .bodySmall + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var textColor: Use = .primary @@ -41,7 +42,7 @@ extension Tilelet { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel { TitleLockup.SubTitleModel(text: text, diff --git a/VDS/Components/Tilelet/TileletTitleModel.swift b/VDS/Components/Tilelet/TileletTitleModel.swift index 4af7a038..84e77529 100644 --- a/VDS/Components/Tilelet/TileletTitleModel.swift +++ b/VDS/Components/Tilelet/TileletTitleModel.swift @@ -24,6 +24,7 @@ extension Tilelet { // MARK: - Public Properties //-------------------------------------------------- public var text: String = "" + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var standardStyle: StandardStyle = .titleSmall @@ -39,7 +40,7 @@ extension Tilelet { } //-------------------------------------------------- - // MARK: - Public Functions + // MARK: - Public Methods //-------------------------------------------------- public func toTitleLockupTitleModel() -> TitleLockup.TitleModel { TitleLockup.TitleModel(text: text, diff --git a/VDS/Components/TitleLockup/TitleLockup.swift b/VDS/Components/TitleLockup/TitleLockup.swift index 2b1dd4db..caa42202 100644 --- a/VDS/Components/TitleLockup/TitleLockup.swift +++ b/VDS/Components/TitleLockup/TitleLockup.swift @@ -288,7 +288,7 @@ open class TitleLockup: View { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift b/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift index eaedccda..4f92ca7e 100644 --- a/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupEyebrowModel.swift @@ -11,6 +11,7 @@ extension TitleLockup { public struct EyebrowModel { public var text: String public var isBold: Bool + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var standardStyle: OtherStandardStyle public var numberOfLines: Int diff --git a/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift b/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift index d7242dd7..7bea3a3c 100644 --- a/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupSubTitleModel.swift @@ -12,6 +12,7 @@ extension TitleLockup { public var text: String public var standardStyle: OtherStandardStyle public var textColor: Use + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var numberOfLines: Int @@ -27,6 +28,7 @@ extension TitleLockup { self.numberOfLines = numberOfLines } + /// TextStyle used to render the text. public var textStyle: TextStyle { standardStyle.value.regular } } diff --git a/VDS/Components/TitleLockup/TitleLockupTitleModel.swift b/VDS/Components/TitleLockup/TitleLockupTitleModel.swift index da490ad5..fc1660b2 100644 --- a/VDS/Components/TitleLockup/TitleLockupTitleModel.swift +++ b/VDS/Components/TitleLockup/TitleLockupTitleModel.swift @@ -10,6 +10,7 @@ import Foundation extension TitleLockup { public struct TitleModel { public var text: String + /// Array of LabelAttributeModel objects used in rendering the text. public var textAttributes: [any LabelAttributeModel]? public var isBold: Bool public var standardStyle: TitleStandardStyle @@ -26,7 +27,8 @@ extension TitleLockup { self.standardStyle = standardStyle self.numberOfLines = numberOfLines } - + + /// TextStyle used to render the text. public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular } } diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 9f030d90..3f8c12f2 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -56,6 +56,7 @@ open class Toggle: Control, Changeable { private let spacingBetween = VDSLayout.Spacing.space3X.value private let labelMaxWidth = 40.0 + /// TextStyle used to render the label. private var textStyle: TextStyle { if textSize == .small { if textWeight == .bold { @@ -194,7 +195,7 @@ open class Toggle: Control, Changeable { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() @@ -255,7 +256,7 @@ open class Toggle: Control, Changeable { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- - + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { if showLabel { label.sizeToFit() diff --git a/VDS/Components/Toggle/ToggleView.swift b/VDS/Components/Toggle/ToggleView.swift index 58292cc4..882793f3 100644 --- a/VDS/Components/Toggle/ToggleView.swift +++ b/VDS/Components/Toggle/ToggleView.swift @@ -165,7 +165,7 @@ open class ToggleView: Control, Changeable { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() @@ -187,6 +187,7 @@ open class ToggleView: Control, Changeable { //-------------------------------------------------- // MARK: - Overrides //-------------------------------------------------- + /// The natural size for the receiving view, considering only properties of the view itself. open override var intrinsicContentSize: CGSize { toggleSize } //-------------------------------------------------- diff --git a/VDS/Components/Tooltip/Tooltip.swift b/VDS/Components/Tooltip/Tooltip.swift index d3adc11d..ea2327b5 100644 --- a/VDS/Components/Tooltip/Tooltip.swift +++ b/VDS/Components/Tooltip/Tooltip.swift @@ -143,7 +143,7 @@ open class Tooltip: Control, TooltipLaunchable { setNeedsUpdate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tooltip/TooltipAlertViewController.swift b/VDS/Components/Tooltip/TooltipAlertViewController.swift index 2be0d921..f0a899cc 100644 --- a/VDS/Components/Tooltip/TooltipAlertViewController.swift +++ b/VDS/Components/Tooltip/TooltipAlertViewController.swift @@ -105,7 +105,7 @@ open class TooltipAlertViewController: UIViewController, Surfaceable { ]) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open func updateView() { view.backgroundColor = backgroundColorConfiguration.getColor(self).withAlphaComponent(0.3) tooltipDialog.surface = surface diff --git a/VDS/Components/Tooltip/TooltipDialog.swift b/VDS/Components/Tooltip/TooltipDialog.swift index ae8aeddd..f87fb52e 100644 --- a/VDS/Components/Tooltip/TooltipDialog.swift +++ b/VDS/Components/Tooltip/TooltipDialog.swift @@ -120,7 +120,7 @@ open class TooltipDialog: View, UIScrollViewDelegate { heightConstraint?.activate() } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Components/Tooltip/TrailingTooltipLabel.swift b/VDS/Components/Tooltip/TrailingTooltipLabel.swift index 0555a5a9..a68dfbbf 100644 --- a/VDS/Components/Tooltip/TrailingTooltipLabel.swift +++ b/VDS/Components/Tooltip/TrailingTooltipLabel.swift @@ -62,7 +62,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable { }.store(in: &subscribers) } - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. open override func updateView() { super.updateView() diff --git a/VDS/Extensions/UIColor.swift b/VDS/Extensions/UIColor.swift index fa90f2cc..9e12c2bb 100644 --- a/VDS/Extensions/UIColor.swift +++ b/VDS/Extensions/UIColor.swift @@ -11,7 +11,7 @@ import VDSColorTokens extension UIColor { //-------------------------------------------------- - // MARK: - Functions + // MARK: - Methods //-------------------------------------------------- /// Convenience to get a grayscale UIColor where the same value is used for red, green, and blue diff --git a/VDS/Protocols/ViewProtocol.swift b/VDS/Protocols/ViewProtocol.swift index f6d878c3..82382ec7 100644 --- a/VDS/Protocols/ViewProtocol.swift +++ b/VDS/Protocols/ViewProtocol.swift @@ -19,7 +19,7 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. func setup() - /// Function used to make changes to the View based off a change events or from local properties. + /// Used to make changes to the View based off a change events or from local properties. func updateView() /// Used to update any Accessibility properties. @@ -27,7 +27,7 @@ public protocol ViewProtocol: AnyObject, Initable, Resettable, Enabling, Surface } extension ViewProtocol { - /// Function called when there are changes in a View based off a change events or from local properties. + /// Called when there are changes in a View based off a change events or from local properties. public func setNeedsUpdate() { if shouldUpdateView { shouldUpdateView = false @@ -50,7 +50,7 @@ extension ViewProtocol where Self: UIView { } extension ViewProtocol where Self: UIControl { - /// Helper function to assign a completion block to a specific UIControl Event using Combine and stored in the subscribers. + /// Helper method to assign a completion block to a specific UIControl Event using Combine and stored in the subscribers. public func addEvent(event: UIControl.Event, block: @escaping (Self)->()) { publisher(for: event) .sink(receiveValue: { c in