From cc0c0fbfb2a0b7da4cca393a1b5b192b0b0d8409 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 26 May 2023 16:47:24 -0500 Subject: [PATCH] added comments for the UIColor+VDSColor extension Signed-off-by: Matt Bruce --- VDS/Extensions/UIColor+VDSColor.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/VDS/Extensions/UIColor+VDSColor.swift b/VDS/Extensions/UIColor+VDSColor.swift index 2b76e403..ad05efc1 100644 --- a/VDS/Extensions/UIColor+VDSColor.swift +++ b/VDS/Extensions/UIColor+VDSColor.swift @@ -9,6 +9,8 @@ import Foundation import VDSColorTokens extension UIColor { + + /// Since VDSColorTokens is just a Class with Static Properties, this is an Enum for each property of that class for each of use within the VDS Library public enum VDSColor: String, CaseIterable { case paletteBlack case paletteWhite @@ -96,7 +98,7 @@ extension UIColor { case elementsLowcontrastOnlight case elementsLowcontrastOndark - // Map each color name to its corresponding UIColor object. + /// Map each color name to its corresponding UIColor object. public var uiColor: UIColor { do { let color = try VDSColorTokens.VDSColor.getTokenByString(tokenName: "VDSColor.\(rawValue)") @@ -107,7 +109,10 @@ extension UIColor { } } } - + + /// Helper method to see if a UIColor exists in the VDSColor enumeration + /// - Parameter color: UIColor needed to compare + /// - Returns: True if found, false in not found in VDSColor enumeration public static func isVDSColor(color: UIColor) -> Bool { guard let hex = color.hexString else { return false } let found = VDSColor.allCases.first{ $0.uiColor.hexString == hex }