added more documentation

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-28 17:17:00 -05:00
parent f398dcf9a8
commit c8ee289640
5 changed files with 28 additions and 1 deletions

View File

@ -81,6 +81,8 @@ open class CheckboxGroup: SelectorGroupHandlerBase<CheckboxItem> {
} }
private var _showError: Bool = false private var _showError: Bool = false
/// Whether not to show the error.
open var showError: Bool { open var showError: Bool {
get { _showError } get { _showError }
set { set {

View File

@ -28,8 +28,10 @@ open class CheckboxItem: SelectorItemBase<Checkbox> {
} }
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // 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() }} open var isAnimated: Bool = false { didSet { setNeedsUpdate() }}
//-------------------------------------------------- //--------------------------------------------------

View File

@ -39,12 +39,14 @@ open class Icon: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Public Properties // MARK: - Public Properties
//-------------------------------------------------- //--------------------------------------------------
/// UIImageView used to render the icon.
open var imageView = UIImageView().with { open var imageView = UIImageView().with {
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill $0.contentMode = .scaleAspectFill
$0.clipsToBounds = true $0.clipsToBounds = true
} }
/// Color of the icon.
open var color: UIColor = VDSColor.paletteBlack { open var color: UIColor = VDSColor.paletteBlack {
didSet { didSet {
if let hex = color.hexString, !UIColor.isVDSColor(color: color) { if let hex = color.hexString, !UIColor.isVDSColor(color: color) {
@ -53,8 +55,14 @@ open class Icon: View {
setNeedsUpdate() setNeedsUpdate()
} }
} }
/// Size of the icon.
open var size: Size = .medium { didSet { setNeedsUpdate() }} open var size: Size = .medium { didSet { setNeedsUpdate() }}
/// This will be used to render the icon with corresponding name.
open var name: Name? { didSet { setNeedsUpdate() }} open var name: Name? { didSet { setNeedsUpdate() }}
/// A custom size of the icon.
open var customSize: Int? { didSet { setNeedsUpdate() }} open var customSize: Int? { didSet { setNeedsUpdate() }}
/// The natural size for the receiving view, considering only properties of the view itself. /// The natural size for the receiving view, considering only properties of the view itself.

View File

@ -10,6 +10,20 @@ import UIKit
import VDSColorTokens import VDSColorTokens
extension Icon { extension Icon {
/// A representation that will be used to render the icon with corresponding name.
///
/// A Icon.Name will only show up as a selection if the developer has created one and added to the Icon.Name namespace.
/// ```
/// /// add the new Icon.Name to the namespace.
/// extension Icon.Name {
/// public static let foo = Name(name: "foo-image")
/// }
///
/// /// use the new Icon.Name you just created.
/// let icon = Icon()
/// icon.name = .foo
/// ```
public struct Name: RawRepresentable { public struct Name: RawRepresentable {
public typealias RawValue = String public typealias RawValue = String
public var rawValue: String public var rawValue: String

View File

@ -8,6 +8,7 @@
import Foundation import Foundation
extension Icon { extension Icon {
/// Enum for a preset height and width for the icon.
public enum Size: String, CaseIterable { public enum Size: String, CaseIterable {
case xsmall case xsmall
case small case small