From ea79ed7b64b3ad966ca8d0815564a7a3b9b2c307 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 4 Oct 2022 09:16:59 -0500 Subject: [PATCH 01/11] fixed background color Signed-off-by: Matt Bruce --- VDS/Protocols/Surfaceable.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VDS/Protocols/Surfaceable.swift b/VDS/Protocols/Surfaceable.swift index d1eec284..d5283a37 100644 --- a/VDS/Protocols/Surfaceable.swift +++ b/VDS/Protocols/Surfaceable.swift @@ -12,7 +12,7 @@ import VDSColorTokens public enum Surface: String, Codable, Equatable { case light, dark public var color: UIColor { - return self == .dark ? VDSColor.backgroundPrimaryDark : .clear + return self == .dark ? VDSColor.backgroundPrimaryDark : VDSColor.backgroundSecondaryLight } } From 0f2c045add771adbfa7e4a639c44e57bbe427489 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 4 Oct 2022 11:38:20 -0500 Subject: [PATCH 02/11] added new properties for accessible and for actions that aren't text Signed-off-by: Matt Bruce --- .../Label/Attributes/LabelAttributeAction.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Label/Attributes/LabelAttributeAction.swift b/VDS/Components/Label/Attributes/LabelAttributeAction.swift index f2a5fe49..7e280a42 100644 --- a/VDS/Components/Label/Attributes/LabelAttributeAction.swift +++ b/VDS/Components/Label/Attributes/LabelAttributeAction.swift @@ -10,6 +10,7 @@ import UIKit import Combine public protocol LabelAttributeActionable: LabelAttributeModel { + var accessibleText: String? { get set } var action: PassthroughSubject { get set } } @@ -29,15 +30,19 @@ public struct LabelAttributeActionModel: LabelAttributeActionable { public var id = UUID() public var location: Int public var length: Int + public var shouldUnderline: Bool + public var accessibleText: String? public var action = PassthroughSubject() //-------------------------------------------------- // MARK: - Initializer //-------------------------------------------------- - public init(location: Int, length: Int) { + public init(location: Int, length: Int, shouldUnderline: Bool = true, accessibleText: String? = nil) { self.location = location self.length = length + self.shouldUnderline = shouldUnderline + self.accessibleText = accessibleText } private enum CodingKeys: String, CodingKey { @@ -45,6 +50,8 @@ public struct LabelAttributeActionModel: LabelAttributeActionable { } public func setAttribute(on attributedString: NSMutableAttributedString) { - attributedString.addAttribute(.underlineStyle, value: UnderlineStyle.single.value(), range: range) + if(shouldUnderline){ + attributedString.addAttribute(.underlineStyle, value: UnderlineStyle.single.value(), range: range) + } } } From 986e410098049f187319457afeb0780d262e9578 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 4 Oct 2022 11:38:44 -0500 Subject: [PATCH 03/11] added accessibleText for actions as an override Signed-off-by: Matt Bruce --- VDS/Components/Label/Label.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 93eb5754..8dae7755 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -161,7 +161,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //see if the attribute is Actionable if let actionable = attribute as? any LabelAttributeActionable{ //create a accessibleAction - let customAccessibilityAction = customAccessibilityAction(range: actionable.range) + let customAccessibilityAction = customAccessibilityAction(range: actionable.range, accessibleText: actionable.accessibleText) //create a wrapper for the attributes range, block and actions.append(LabelAction(range: actionable.range, action: actionable.action, accessibilityID: customAccessibilityAction?.hashValue ?? -1)) @@ -274,7 +274,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Accessibility For Actions //-------------------------------------------------- - private func customAccessibilityAction(range: NSRange) -> UIAccessibilityCustomAction? { + private func customAccessibilityAction(range: NSRange, accessibleText: String? = nil) -> UIAccessibilityCustomAction? { guard let text = text else { return nil } //TODO: accessibilityHint for Label @@ -282,7 +282,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt // accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "swipe_to_select_with_action_hint") // } - let actionText = NSString(string: text).substring(with: range) + let actionText = accessibleText ?? NSString(string:text).substring(with: range) let accessibleAction = UIAccessibilityCustomAction(name: actionText, target: self, selector: #selector(accessibilityCustomAction(_:))) accessibilityCustomActions?.append(accessibleAction) From 3b75957ce1aa90d627c2c23653178935306fa5e1 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 7 Oct 2022 09:15:05 -0500 Subject: [PATCH 04/11] accessable update Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 2 +- VDS/Components/Checkbox/Checkbox.swift | 2 +- VDS/Components/RadioBox/RadioBox.swift | 2 +- VDS/Components/RadioButton/RadioButton.swift | 2 +- VDS/Components/RadioSwatch/RadioSwatch.swift | 2 +- VDS/Components/Toggle/Toggle.swift | 2 +- VDS/Protocols/Accessable.swift | 21 +++++++++++--------- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 1f3fe2b2..69d41b6a 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -178,7 +178,7 @@ open class BadgeBase: View { maxWidthConstraint?.isActive = false } label.set(with: viewModel.label) - setAccessibilityLabel(!viewModel.disabled) + setAccessibilityLabel() } } diff --git a/VDS/Components/Checkbox/Checkbox.swift b/VDS/Components/Checkbox/Checkbox.swift index 46e6d034..caf2dd8a 100644 --- a/VDS/Components/Checkbox/Checkbox.swift +++ b/VDS/Components/Checkbox/Checkbox.swift @@ -234,7 +234,7 @@ open class CheckboxBase: Control { updateLabels(viewModel) updateSelector(viewModel) - setAccessibilityHint(enabled) + setAccessibilityHint() setAccessibilityValue(viewModel.selected) setAccessibilityLabel(viewModel.selected) setNeedsLayout() diff --git a/VDS/Components/RadioBox/RadioBox.swift b/VDS/Components/RadioBox/RadioBox.swift index 6b860403..4d71159d 100644 --- a/VDS/Components/RadioBox/RadioBox.swift +++ b/VDS/Components/RadioBox/RadioBox.swift @@ -211,7 +211,7 @@ open class RadioBoxBase: Control { updateLabels(viewModel) updateSelector(viewModel) - setAccessibilityHint(enabled) + setAccessibilityHint() setAccessibilityValue(viewModel.selected) setAccessibilityLabel(viewModel.selected) setNeedsLayout() diff --git a/VDS/Components/RadioButton/RadioButton.swift b/VDS/Components/RadioButton/RadioButton.swift index be4a6967..cb2081c9 100644 --- a/VDS/Components/RadioButton/RadioButton.swift +++ b/VDS/Components/RadioButton/RadioButton.swift @@ -244,7 +244,7 @@ open class RadioButtonBase: Control { updateLabels(viewModel) updateSelector(viewModel) - setAccessibilityHint(enabled) + setAccessibilityHint() setAccessibilityValue(viewModel.selected) setAccessibilityLabel(viewModel.selected) setNeedsLayout() diff --git a/VDS/Components/RadioSwatch/RadioSwatch.swift b/VDS/Components/RadioSwatch/RadioSwatch.swift index 235b28bd..1d0e4164 100644 --- a/VDS/Components/RadioSwatch/RadioSwatch.swift +++ b/VDS/Components/RadioSwatch/RadioSwatch.swift @@ -144,7 +144,7 @@ open class RadioSwatchBase: Control { let enabled = !viewModel.disabled updateSelector(viewModel) - setAccessibilityHint(enabled) + setAccessibilityHint() setAccessibilityValue(viewModel.selected) setAccessibilityLabel(viewModel.selected) setNeedsLayout() diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index b66d4eef..27d19634 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -333,7 +333,7 @@ open class ToggleBase: Control { label.set(with: viewModel.label) updateLabel(viewModel) updateToggle(viewModel) - setAccessibilityHint(!viewModel.disabled) + setAccessibilityHint() setAccessibilityValue(viewModel.on) setAccessibilityLabel(viewModel.on) backgroundColor = viewModel.surface.color diff --git a/VDS/Protocols/Accessable.swift b/VDS/Protocols/Accessable.swift index 35afd6e6..fd9ad370 100644 --- a/VDS/Protocols/Accessable.swift +++ b/VDS/Protocols/Accessable.swift @@ -26,26 +26,29 @@ extension ModelHandlerable where Self: UIView { return model } - public func setAccessibilityHint(_ enabled: Bool = true) { - if let value = accessableModel?.accessibilityHintEnabled, enabled { + public func setAccessibilityHint(_ override: Bool? = nil) { + let check = override ?? !model.disabled + if let value = accessableModel?.accessibilityHintEnabled, check { accessibilityHint = value - } else if let value = accessableModel?.accessibilityHintDisabled, !enabled { + } else if let value = accessableModel?.accessibilityHintDisabled, !check { accessibilityHint = value } } - public func setAccessibilityValue(_ enabled: Bool = true) { - if let value = accessableModel?.accessibilityValueEnabled, enabled { + public func setAccessibilityValue(_ override: Bool? = nil) { + let check = override ?? !model.disabled + if let value = accessableModel?.accessibilityValueEnabled, check { accessibilityValue = value - } else if let value = accessableModel?.accessibilityValueDisabled, !enabled { + } else if let value = accessableModel?.accessibilityValueDisabled, !check { accessibilityValue = value } } - public func setAccessibilityLabel(_ enabled: Bool = true) { - if let value = accessableModel?.accessibilityLabelEnabled, enabled { + public func setAccessibilityLabel(_ override: Bool? = nil) { + let check = override ?? !model.disabled + if let value = accessableModel?.accessibilityLabelEnabled, check { accessibilityLabel = value - } else if let value = accessableModel?.accessibilityLabelDisabled, !enabled { + } else if let value = accessableModel?.accessibilityLabelDisabled, !check { accessibilityLabel = value } } From f6b0696457415bd7da906913a9477fe882214b22 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 10:22:37 -0500 Subject: [PATCH 05/11] added AnyColorConfiguration Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index 8633185e..831d9704 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol Colorable: AnyObject, ObjectWithable, Initable { +public protocol Colorable: AnyObject, ObjectWithable { associatedtype ModelType func getColor(_ viewModel: ModelType) -> UIColor } @@ -33,7 +33,7 @@ extension BinaryColorable where Self: Selectable { /// config.darkColor = .white /// /// let textColor = config.getColor(model) //returns .black -open class SurfaceColorConfiguration: Colorable { +open class SurfaceColorConfiguration: Colorable, Initable { public var lightColor: UIColor = .clear public var darkColor: UIColor = .clear @@ -64,7 +64,7 @@ open class SurfaceColorConfiguration: Colorable { /// let textColor = config.getColor(model) //returns .white /// /// -open class DisabledSurfaceColorConfiguration: Colorable { +open class DisabledSurfaceColorConfiguration: Colorable, Initable { public var disabled = SurfaceColorConfiguration() public var enabled = SurfaceColorConfiguration() @@ -95,7 +95,7 @@ open class DisabledSurfaceColorConfiguration: /// let textColor = config.getColor(model) //returns .white /// /// -open class BinarySurfaceColorConfiguration: Colorable{ +open class BinarySurfaceColorConfiguration: Colorable, Initable{ public var forTrue = SurfaceColorConfiguration() public var forFalse = SurfaceColorConfiguration() @@ -132,7 +132,7 @@ open class BinarySurfaceColorConfiguration: Colorable { +open class BinaryDisabledSurfaceColorConfiguration: Colorable, Initable { public var forTrue = DisabledSurfaceColorConfiguration() public var forFalse = DisabledSurfaceColorConfiguration() @@ -142,3 +142,15 @@ open class BinaryDisabledSurfaceColorConfiguration: Colorable { + + private var colorHelper: (ModelType) -> UIColor + + public init(colorable: C) where C.ModelType == ModelType { + colorHelper = colorable.getColor(_:) + } + public func getColor(_ viewModel: ModelType) -> UIColor { + colorHelper(viewModel) + } +} From 50bb9dd3d46781d38740b500d8d3be38e22e3da8 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 10:44:04 -0500 Subject: [PATCH 06/11] updated label/badge to AnyColorable Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 24 ++++++++++++------------ VDS/Components/Badge/Badge.swift | 14 +++++++------- VDS/Components/Label/Label.swift | 4 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index 831d9704..cad4fd18 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -13,6 +13,18 @@ public protocol Colorable: AnyObject, ObjectWithable { func getColor(_ viewModel: ModelType) -> UIColor } +public class AnyColorable: Colorable { + + private var wrapper: (ModelType) -> UIColor + + public init(colorable: C) where C.ModelType == ModelType { + wrapper = colorable.getColor(_:) + } + public func getColor(_ viewModel: ModelType) -> UIColor { + wrapper(viewModel) + } +} + public protocol BinaryColorable{ var userTrueColor: Bool { get } } @@ -142,15 +154,3 @@ open class BinaryDisabledSurfaceColorConfiguration: Colorable { - - private var colorHelper: (ModelType) -> UIColor - - public init(colorable: C) where C.ModelType == ModelType { - colorHelper = colorable.getColor(_:) - } - public func getColor(_ viewModel: ModelType) -> UIColor { - colorHelper(viewModel) - } -} diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 69d41b6a..ed724abe 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -133,31 +133,31 @@ open class BadgeBase: View { return config.getColor(model) } - public func textColorConfiguration(for fillColor: BadgeFillColor) -> DisabledSurfaceColorConfiguration { + public func textColorConfiguration(for fillColor: BadgeFillColor) -> AnyColorable { switch fillColor { case .red, .black: - return DisabledSurfaceColorConfiguration().with { + return .init(colorable: DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOndark $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - } + }) case .yellow, .white: - return DisabledSurfaceColorConfiguration().with { + return .init(colorable: DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOnlight $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.enabled.darkColor = VDSColor.elementsPrimaryOnlight - } + }) case .orange, .green, .blue: - return DisabledSurfaceColorConfiguration().with { + return .init(colorable: DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOndark $0.enabled.darkColor = VDSColor.elementsPrimaryOnlight - } + }) } } diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 8dae7755..a6fdb666 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -67,12 +67,12 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - public var textColorConfiguration = DisabledSurfaceColorConfiguration().with { + public var textColorConfiguration: AnyColorable = .init(colorable: DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight $0.disabled.darkColor = VDSColor.elementsSecondaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - } + }) //-------------------------------------------------- // MARK: - Initializers From 56563885b83f385b3ac2a8e7d161e06c3e122c98 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 10:52:49 -0500 Subject: [PATCH 07/11] added type erasure Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 6 ++++++ VDS/Components/Badge/Badge.swift | 12 ++++++------ VDS/Components/Label/Label.swift | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index cad4fd18..373ab90c 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -13,6 +13,12 @@ public protocol Colorable: AnyObject, ObjectWithable { func getColor(_ viewModel: ModelType) -> UIColor } +extension Colorable { + public func eraseToAnyColorable() -> AnyColorable { + AnyColorable(colorable: self) + } +} + public class AnyColorable: Colorable { private var wrapper: (ModelType) -> UIColor diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index ed724abe..285b228d 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -138,26 +138,26 @@ open class BadgeBase: View { switch fillColor { case .red, .black: - return .init(colorable: DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOndark $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - }) + }.eraseToAnyColorable() case .yellow, .white: - return .init(colorable: DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOnlight $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.enabled.darkColor = VDSColor.elementsPrimaryOnlight - }) + }.eraseToAnyColorable() case .orange, .green, .blue: - return .init(colorable: DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOndark $0.enabled.darkColor = VDSColor.elementsPrimaryOnlight - }) + }.eraseToAnyColorable() } } diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index a6fdb666..b5f89610 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -67,12 +67,12 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - public var textColorConfiguration: AnyColorable = .init(colorable: DisabledSurfaceColorConfiguration().with { + public var textColorConfiguration: AnyColorable = DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight $0.disabled.darkColor = VDSColor.elementsSecondaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - }) + }.eraseToAnyColorable() //-------------------------------------------------- // MARK: - Initializers From 802fd385bf8b571c5b40e76b073b58051642c0cd Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 12:47:18 -0500 Subject: [PATCH 08/11] refactored more colorable for AnyColorable Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 22 ++++++++++++---------- VDS/Components/Button/Button.swift | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index 373ab90c..fa4b30d8 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol Colorable: AnyObject, ObjectWithable { +public protocol Colorable { associatedtype ModelType func getColor(_ viewModel: ModelType) -> UIColor } @@ -19,15 +19,15 @@ extension Colorable { } } -public class AnyColorable: Colorable { - - private var wrapper: (ModelType) -> UIColor +public struct AnyColorable: Colorable, Withable { + private var wrapped: any Colorable public init(colorable: C) where C.ModelType == ModelType { - wrapper = colorable.getColor(_:) + wrapped = colorable } + public func getColor(_ viewModel: ModelType) -> UIColor { - wrapper(viewModel) + wrapped.getColor(viewModel) } } @@ -39,6 +39,8 @@ extension BinaryColorable where Self: Selectable { public var userTrueColor: Bool { return selected } } +public typealias ClassColorable = Colorable & Initable & ObjectWithable + /// Meant to be used in a Object that implements the following interfaces for 2 possible color combinations /// - Surfaceable (var surface: Surface) /// @@ -51,7 +53,7 @@ extension BinaryColorable where Self: Selectable { /// config.darkColor = .white /// /// let textColor = config.getColor(model) //returns .black -open class SurfaceColorConfiguration: Colorable, Initable { +open class SurfaceColorConfiguration: ClassColorable { public var lightColor: UIColor = .clear public var darkColor: UIColor = .clear @@ -82,7 +84,7 @@ open class SurfaceColorConfiguration: Colorable, Initable /// let textColor = config.getColor(model) //returns .white /// /// -open class DisabledSurfaceColorConfiguration: Colorable, Initable { +open class DisabledSurfaceColorConfiguration: ClassColorable { public var disabled = SurfaceColorConfiguration() public var enabled = SurfaceColorConfiguration() @@ -113,7 +115,7 @@ open class DisabledSurfaceColorConfiguration: /// let textColor = config.getColor(model) //returns .white /// /// -open class BinarySurfaceColorConfiguration: Colorable, Initable{ +open class BinarySurfaceColorConfiguration: ClassColorable { public var forTrue = SurfaceColorConfiguration() public var forFalse = SurfaceColorConfiguration() @@ -150,7 +152,7 @@ open class BinarySurfaceColorConfiguration: Colorable, Initable { +open class BinaryDisabledSurfaceColorConfiguration: ClassColorable { public var forTrue = DisabledSurfaceColorConfiguration() public var forFalse = DisabledSurfaceColorConfiguration() diff --git a/VDS/Components/Button/Button.swift b/VDS/Components/Button/Button.swift index bdddb0a9..46f916ab 100644 --- a/VDS/Components/Button/Button.swift +++ b/VDS/Components/Button/Button.swift @@ -213,7 +213,7 @@ open class ButtonBase: UIButton, ModelHandlerable, ViewP // MARK: - PRIVATE //-------------------------------------------------- - private class UseableColorConfiguration : Colorable { + private class UseableColorConfiguration : ClassColorable { public var primary = DisabledSurfaceColorConfiguration() public var secondary = DisabledSurfaceColorConfiguration() From eac9eaf75152c0609d14c6b1e41eea903d803e8f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 13:51:18 -0500 Subject: [PATCH 09/11] refactored colorable again Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 23 ------------- VDS/Components/Badge/Badge.swift | 2 +- VDS/Components/Label/Label.swift | 2 +- VDS/Protocols/Colorable.swift | 50 ++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 VDS/Protocols/Colorable.swift diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index fa4b30d8..dc66efc8 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -8,29 +8,6 @@ import Foundation import UIKit -public protocol Colorable { - associatedtype ModelType - func getColor(_ viewModel: ModelType) -> UIColor -} - -extension Colorable { - public func eraseToAnyColorable() -> AnyColorable { - AnyColorable(colorable: self) - } -} - -public struct AnyColorable: Colorable, Withable { - private var wrapped: any Colorable - - public init(colorable: C) where C.ModelType == ModelType { - wrapped = colorable - } - - public func getColor(_ viewModel: ModelType) -> UIColor { - wrapped.getColor(viewModel) - } -} - public protocol BinaryColorable{ var userTrueColor: Bool { get } } diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 285b228d..caf908b0 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -133,7 +133,7 @@ open class BadgeBase: View { return config.getColor(model) } - public func textColorConfiguration(for fillColor: BadgeFillColor) -> AnyColorable { + public func textColorConfiguration(for fillColor: BadgeFillColor) -> AnyColorable { switch fillColor { diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index b5f89610..86364426 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -67,7 +67,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - public var textColorConfiguration: AnyColorable = DisabledSurfaceColorConfiguration().with { + public var textColorConfiguration: AnyColorable = DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight $0.disabled.darkColor = VDSColor.elementsSecondaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight diff --git a/VDS/Protocols/Colorable.swift b/VDS/Protocols/Colorable.swift new file mode 100644 index 00000000..92a7f461 --- /dev/null +++ b/VDS/Protocols/Colorable.swift @@ -0,0 +1,50 @@ +// +// Colorable.swift +// VDS +// +// Created by Matt Bruce on 10/10/22. +// + +import Foundation +import UIKit + +public protocol Colorable { + associatedtype ModelType + func getColor(_ viewModel: ModelType) -> UIColor +} + +extension Colorable { + fileprivate func getColor(_ viewModel: Any) -> UIColor { + guard let model = viewModel as? ModelType else { + assertionFailure("Invalid ModelType, Expecting type \(ModelType.self), received \(viewModel) ") + return .black + } + return getColor(model) + } + + public func eraseToAnyColorable() -> AnyColorable { AnyColorable(self) } +} + +public struct GenericColorable: Colorable, Withable { + private var wrapped: any Colorable + + public init(colorable: C) where C.ModelType == ModelType { + wrapped = colorable + } + + public func getColor(_ viewModel: ModelType) -> UIColor { + wrapped.getColor(viewModel) + } +} + +public struct AnyColorable: Colorable, Withable { + private let wrapped: any Colorable + + public init(_ colorable: any Colorable) { + wrapped = colorable + } + + public func getColor(_ viewModel: Any) -> UIColor { + wrapped.getColor(viewModel) + } +} From d0001f8af790b7356a54cd1f67dc5a8c5617aa6b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 16:22:28 -0500 Subject: [PATCH 10/11] updated color config Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 108 ++++++++++++++----- VDS/Components/Badge/Badge.swift | 22 ++-- VDS/Components/Button/Button.swift | 81 +++++++------- VDS/Components/Checkbox/Checkbox.swift | 55 +++++----- VDS/Components/Label/Label.swift | 2 +- VDS/Components/RadioBox/RadioBox.swift | 52 ++++----- VDS/Components/RadioButton/RadioButton.swift | 86 ++++++--------- VDS/Components/RadioSwatch/RadioSwatch.swift | 61 +++++------ VDS/Components/Toggle/Toggle.swift | 44 ++++---- VDS/Protocols/Withable.swift | 1 + 10 files changed, 260 insertions(+), 252 deletions(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index dc66efc8..da63fc3a 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -8,15 +8,7 @@ import Foundation import UIKit -public protocol BinaryColorable{ - var userTrueColor: Bool { get } -} - -extension BinaryColorable where Self: Selectable { - public var userTrueColor: Bool { return selected } -} - -public typealias ClassColorable = Colorable & Initable & ObjectWithable +public typealias ObjectColorable = Colorable & Initable & ObjectWithable /// Meant to be used in a Object that implements the following interfaces for 2 possible color combinations /// - Surfaceable (var surface: Surface) @@ -30,16 +22,31 @@ public typealias ClassColorable = Colorable & Initable & ObjectWithable /// config.darkColor = .white /// /// let textColor = config.getColor(model) //returns .black -open class SurfaceColorConfiguration: ClassColorable { +final public class SurfaceColorConfiguration: ObjectColorable { + public typealias ModelType = Surfaceable public var lightColor: UIColor = .clear public var darkColor: UIColor = .clear required public init(){} - public func getColor(_ viewModel: ModelType) -> UIColor { + public func getColor(_ viewModel: any ModelType) -> UIColor { return viewModel.surface == .light ? lightColor : darkColor } } +///------------------------------------------------------------------- +///MARK -- DisabledSurfaceColorable +///------------------------------------------------------------------- +public protocol DisabledSurfaceColorable: ObjectColorable { + var disabled: SurfaceColorConfiguration { get set } + var enabled: SurfaceColorConfiguration { get set } +} + +extension DisabledSurfaceColorable { + public func getDisabledColor (_ viewModel: M) -> UIColor { + viewModel.disabled ? disabled.getColor(viewModel) : enabled.getColor(viewModel) + } +} + /// Meant to be used in a Object that implements the following interfaces for 4 possible color combinations /// - Disabling (var disabled: Bool) /// - Surfaceable (var surface: Surface) @@ -48,7 +55,7 @@ open class SurfaceColorConfiguration: ClassColorable { /// model.surface = .dark /// model.disabled = false /// -/// let config = DisabledSurfaceColorConfiguration() +/// let config = DisabledSurfaceColorConfiguration() /// /// //disabled == false /// config.enabled.lightColor = .black @@ -61,14 +68,40 @@ open class SurfaceColorConfiguration: ClassColorable { /// let textColor = config.getColor(model) //returns .white /// /// -open class DisabledSurfaceColorConfiguration: ClassColorable { - public var disabled = SurfaceColorConfiguration() - public var enabled = SurfaceColorConfiguration() +final public class DisabledSurfaceColorConfiguration: DisabledSurfaceColorable { + public typealias ModelType = Surfaceable & Disabling + public var disabled = SurfaceColorConfiguration() + public var enabled = SurfaceColorConfiguration() required public init(){} - public func getColor(_ viewModel: ModelType) -> UIColor { - return viewModel.disabled ? disabled.getColor(viewModel) : enabled.getColor(viewModel) + public func getColor(_ viewModel: any ModelType) -> UIColor { + getDisabledColor(viewModel) + } +} + +///------------------------------------------------------------------- +///MARK -- BinaryColorable +///------------------------------------------------------------------- +public protocol BinaryColorable{ + var userTrueColor: Bool { get } +} + +extension BinaryColorable where Self: Selectable { + public var userTrueColor: Bool { return selected } +} + +///------------------------------------------------------------------- +///MARK -- BinarySurfaceColorable +///------------------------------------------------------------------- +public protocol BinarySurfaceColorable: ObjectColorable { + var forTrue: SurfaceColorConfiguration { get set } + var forFalse: SurfaceColorConfiguration { get set } +} + +extension BinarySurfaceColorable { + public func getBinaryColor(_ viewModel: M) -> UIColor { + viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) } } @@ -79,7 +112,7 @@ open class DisabledSurfaceColorConfiguration: /// let model = TestModel() /// model.surface = .dark /// model.on = true //this is read in the extension var userTrueColor -/// let config = BinarySurfaceColorConfiguration() +/// let config = BinarySurfaceColorConfiguration() /// /// //True from BinaryColorable.userTrueColor /// config.forTrue.lightColor = .black @@ -92,14 +125,30 @@ open class DisabledSurfaceColorConfiguration: /// let textColor = config.getColor(model) //returns .white /// /// -open class BinarySurfaceColorConfiguration: ClassColorable { - public var forTrue = SurfaceColorConfiguration() - public var forFalse = SurfaceColorConfiguration() +final public class BinarySurfaceColorConfiguration: BinarySurfaceColorable { + public typealias ModelType = Surfaceable & BinaryColorable + public var forTrue = SurfaceColorConfiguration() + public var forFalse = SurfaceColorConfiguration() required public init(){} - public func getColor(_ viewModel: ModelType) -> UIColor { - return viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) + public func getColor(_ viewModel: any ModelType) -> UIColor { + getBinaryColor(viewModel) + } +} + +///------------------------------------------------------------------- +///MARK -- BinaryDisabledSurfaceColorable +///------------------------------------------------------------------- + +public protocol BinaryDisabledSurfaceColorable: ObjectColorable { + var forTrue: DisabledSurfaceColorConfiguration { get set } + var forFalse: DisabledSurfaceColorConfiguration { get set } +} + +extension BinaryDisabledSurfaceColorable { + public func getBinaryColor(_ viewModel: M) -> UIColor { + viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) } } @@ -112,7 +161,7 @@ open class BinarySurfaceColorConfiguration() +/// let config = BinaryDisabledSurfaceColorConfiguration() /// /// //True /// config.forTrue.enabled.lightColor = .black @@ -129,13 +178,14 @@ open class BinarySurfaceColorConfiguration: ClassColorable { - public var forTrue = DisabledSurfaceColorConfiguration() - public var forFalse = DisabledSurfaceColorConfiguration() +final public class BinaryDisabledSurfaceColorConfiguration: BinaryDisabledSurfaceColorable { + public typealias ModelType = Disabling & Surfaceable & BinaryColorable + public var forTrue = DisabledSurfaceColorConfiguration() + public var forFalse = DisabledSurfaceColorConfiguration() required public init(){} - public func getColor(_ viewModel: ModelType) -> UIColor { - return viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) + public func getColor(_ viewModel: any ModelType) -> UIColor { + getBinaryColor(viewModel) } } diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index caf908b0..746a445b 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -91,40 +91,40 @@ open class BadgeBase: View { // MARK: - Configuration //-------------------------------------------------- public func backgroundColor(for fillColor: BadgeFillColor) -> UIColor { - var config: SurfaceColorConfiguration + var config: SurfaceColorConfiguration switch model.fillColor { case .red: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.backgroundBrandhighlight $0.darkColor = VDSColor.backgroundBrandhighlight } case .yellow: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteYellow62 $0.darkColor = VDSColor.paletteYellow62 } case .green: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteGreen26 $0.darkColor = VDSColor.paletteGreen34 } case .orange: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteOrange39 $0.darkColor = VDSColor.paletteOrange46 } case .blue: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteBlue35 $0.darkColor = VDSColor.paletteBlue45 } case .black: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteBlack $0.darkColor = VDSColor.paletteBlack } case .white: - config = SurfaceColorConfiguration().with { + config = SurfaceColorConfiguration().with { $0.lightColor = VDSColor.paletteWhite $0.darkColor = VDSColor.paletteWhite } @@ -138,21 +138,21 @@ open class BadgeBase: View { switch fillColor { case .red, .black: - return DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOndark $0.enabled.darkColor = VDSColor.elementsPrimaryOndark }.eraseToAnyColorable() case .yellow, .white: - return DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOnlight $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.enabled.darkColor = VDSColor.elementsPrimaryOnlight }.eraseToAnyColorable() case .orange, .green, .blue: - return DisabledSurfaceColorConfiguration().with { + return DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsPrimaryOndark $0.disabled.darkColor = VDSColor.elementsPrimaryOnlight $0.enabled.lightColor = VDSColor.elementsPrimaryOndark diff --git a/VDS/Components/Button/Button.swift b/VDS/Components/Button/Button.swift index 46f916ab..d31d4807 100644 --- a/VDS/Components/Button/Button.swift +++ b/VDS/Components/Button/Button.swift @@ -65,51 +65,45 @@ open class ButtonBase: UIButton, ModelHandlerable, ViewP isUserInteractionEnabled = isEnabled } } - + //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - private var buttonBackgroundColorConfiguration: UseableColorConfiguration = { - return UseableColorConfiguration().with { - $0.primary.enabled.lightColor = VDSColor.backgroundPrimaryDark - $0.primary.enabled.darkColor = VDSColor.backgroundPrimaryLight - $0.primary.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.primary.disabled.darkColor = VDSColor.interactiveDisabledOndark - - $0.secondary.enabled.lightColor = UIColor.clear - $0.secondary.enabled.darkColor = UIColor.clear - $0.secondary.disabled.lightColor = UIColor.clear - $0.secondary.disabled.darkColor = UIColor.clear - } - }() + private var buttonBackgroundColorConfiguration = UseableColorConfiguration().with { + $0.primary.enabled.lightColor = VDSColor.backgroundPrimaryDark + $0.primary.enabled.darkColor = VDSColor.backgroundPrimaryLight + $0.primary.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.primary.disabled.darkColor = VDSColor.interactiveDisabledOndark + + $0.secondary.enabled.lightColor = UIColor.clear + $0.secondary.enabled.darkColor = UIColor.clear + $0.secondary.disabled.lightColor = UIColor.clear + $0.secondary.disabled.darkColor = UIColor.clear + } - private var buttonBorderColorConfiguration: UseableColorConfiguration = { - return UseableColorConfiguration().with { - $0.primary.enabled.lightColor = VDSColor.elementsPrimaryOndark - $0.primary.enabled.darkColor = VDSColor.elementsPrimaryOnlight - $0.primary.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.primary.disabled.darkColor = VDSColor.interactiveDisabledOndark - - $0.secondary.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.secondary.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.secondary.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.secondary.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() + private var buttonBorderColorConfiguration = UseableColorConfiguration().with { + $0.primary.enabled.lightColor = VDSColor.elementsPrimaryOndark + $0.primary.enabled.darkColor = VDSColor.elementsPrimaryOnlight + $0.primary.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.primary.disabled.darkColor = VDSColor.interactiveDisabledOndark + + $0.secondary.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.secondary.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.secondary.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.secondary.disabled.darkColor = VDSColor.interactiveDisabledOndark + } - private var buttonTitleColorConfiguration: UseableColorConfiguration = { - return UseableColorConfiguration().with { - $0.primary.enabled.lightColor = VDSColor.elementsPrimaryOndark - $0.primary.enabled.darkColor = VDSColor.elementsPrimaryOnlight - $0.primary.disabled.lightColor = VDSColor.elementsPrimaryOndark - $0.primary.disabled.darkColor = VDSColor.elementsPrimaryOnlight - - $0.secondary.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.secondary.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.secondary.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.secondary.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() + private var buttonTitleColorConfiguration = UseableColorConfiguration().with { + $0.primary.enabled.lightColor = VDSColor.elementsPrimaryOndark + $0.primary.enabled.darkColor = VDSColor.elementsPrimaryOnlight + $0.primary.disabled.lightColor = VDSColor.elementsPrimaryOndark + $0.primary.disabled.darkColor = VDSColor.elementsPrimaryOnlight + + $0.secondary.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.secondary.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.secondary.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.secondary.disabled.darkColor = VDSColor.interactiveDisabledOndark + } //-------------------------------------------------- // MARK: - Initializers @@ -213,9 +207,10 @@ open class ButtonBase: UIButton, ModelHandlerable, ViewP // MARK: - PRIVATE //-------------------------------------------------- - private class UseableColorConfiguration : ClassColorable { - public var primary = DisabledSurfaceColorConfiguration() - public var secondary = DisabledSurfaceColorConfiguration() + private class UseableColorConfiguration: ObjectColorable { + typealias ModelType = Disabling & Surfaceable & Useable + public var primary = DisabledSurfaceColorConfiguration() + public var secondary = DisabledSurfaceColorConfiguration() required public init(){} diff --git a/VDS/Components/Checkbox/Checkbox.swift b/VDS/Components/Checkbox/Checkbox.swift index caf2dd8a..e14e5b2b 100644 --- a/VDS/Components/Checkbox/Checkbox.swift +++ b/VDS/Components/Checkbox/Checkbox.swift @@ -230,8 +230,6 @@ open class CheckboxBase: Control { // MARK: - State //-------------------------------------------------- open override func updateView(viewModel: ModelType) { - let enabled = !viewModel.disabled - updateLabels(viewModel) updateSelector(viewModel) setAccessibilityHint() @@ -247,8 +245,8 @@ open class CheckboxBase: Control { //-------------------------------------------------- public let checkboxSize = CGSize(width: 20, height: 20) - private var checkboxBackgroundColorConfiguration: CheckboxErrorColorConfiguration = { - return CheckboxErrorColorConfiguration().with { + private var checkboxBackgroundColorConfiguration: ErrorBinaryDisabledSurfaceColorConfiguration = { + return ErrorBinaryDisabledSurfaceColorConfiguration().with { $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight @@ -261,8 +259,8 @@ open class CheckboxBase: Control { } }() - private var checkboxBorderColorConfiguration: CheckboxErrorColorConfiguration = { - return CheckboxErrorColorConfiguration().with { + private var checkboxBorderColorConfiguration: ErrorBinaryDisabledSurfaceColorConfiguration = { + return ErrorBinaryDisabledSurfaceColorConfiguration().with { $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight @@ -279,8 +277,8 @@ open class CheckboxBase: Control { } }() - private var checkboxCheckColorConfiguration: BinarySurfaceColorConfiguration = { - return BinarySurfaceColorConfiguration().with { + private var checkboxCheckColorConfiguration: BinarySurfaceColorConfiguration = { + return BinarySurfaceColorConfiguration().with { $0.forTrue.lightColor = VDSColor.elementsPrimaryOndark $0.forTrue.darkColor = VDSColor.elementsPrimaryOnlight } @@ -346,23 +344,28 @@ open class CheckboxBase: Control { } } } - - //-------------------------------------------------- - // MARK: - Color Class Configurations - //-------------------------------------------------- - private class CheckboxErrorColorConfiguration: BinaryDisabledSurfaceColorConfiguration { - public let error = BinarySurfaceColorConfiguration() - override func getColor(_ viewModel: ModelType) -> UIColor { - //only show error is enabled and showError == true - let showErrorColor = !viewModel.disabled && viewModel.showError - - if showErrorColor { - return error.getColor(viewModel) - } else { - return super.getColor(viewModel) - } - } - } - +} + +//-------------------------------------------------- +// MARK: - Color Class Configurations +//-------------------------------------------------- +internal class ErrorBinaryDisabledSurfaceColorConfiguration: BinaryDisabledSurfaceColorable { + typealias ModelType = Errorable & Disabling & Surfaceable & BinaryColorable + var error = BinarySurfaceColorConfiguration() + var forTrue = DisabledSurfaceColorConfiguration() + var forFalse = DisabledSurfaceColorConfiguration() + + required init() {} + + func getColor(_ viewModel: ModelType) -> UIColor { + //only show error is enabled and showError == true + let showErrorColor = !viewModel.disabled && viewModel.showError + + if showErrorColor { + return error.getColor(viewModel) + } else { + return getBinaryColor(viewModel) + } + } } diff --git a/VDS/Components/Label/Label.swift b/VDS/Components/Label/Label.swift index 86364426..7601c8d1 100644 --- a/VDS/Components/Label/Label.swift +++ b/VDS/Components/Label/Label.swift @@ -67,7 +67,7 @@ open class LabelBase: UILabel, ModelHandlerable, ViewProt //-------------------------------------------------- // MARK: - Configuration Properties //-------------------------------------------------- - public var textColorConfiguration: AnyColorable = DisabledSurfaceColorConfiguration().with { + public var textColorConfiguration: AnyColorable = DisabledSurfaceColorConfiguration().with { $0.disabled.lightColor = VDSColor.elementsSecondaryOnlight $0.disabled.darkColor = VDSColor.elementsSecondaryOndark $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight diff --git a/VDS/Components/RadioBox/RadioBox.swift b/VDS/Components/RadioBox/RadioBox.swift index 4d71159d..a4e47b40 100644 --- a/VDS/Components/RadioBox/RadioBox.swift +++ b/VDS/Components/RadioBox/RadioBox.swift @@ -207,8 +207,6 @@ open class RadioBoxBase: Control { // MARK: - State //-------------------------------------------------- open override func updateView(viewModel: ModelType) { - let enabled = !viewModel.disabled - updateLabels(viewModel) updateSelector(viewModel) setAccessibilityHint() @@ -227,34 +225,30 @@ open class RadioBoxBase: Control { private var selectorBorderWidthSelected: CGFloat = 2.0 private var selectorBorderWidth: CGFloat = 1.0 - private var radioBoxBackgroundColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forFalse.enabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forFalse.enabled.darkColor = VDSFormControlsColor.backgroundOndark - $0.forFalse.disabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forFalse.disabled.darkColor = VDSFormControlsColor.backgroundOndark - - $0.forTrue.enabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forTrue.enabled.darkColor = VDSFormControlsColor.backgroundOndark - $0.forTrue.disabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forTrue.disabled.darkColor = VDSFormControlsColor.backgroundOndark - } - }() + private var radioBoxBackgroundColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forFalse.enabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forFalse.enabled.darkColor = VDSFormControlsColor.backgroundOndark + $0.forFalse.disabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forFalse.disabled.darkColor = VDSFormControlsColor.backgroundOndark + + $0.forTrue.enabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forTrue.enabled.darkColor = VDSFormControlsColor.backgroundOndark + $0.forTrue.disabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forTrue.disabled.darkColor = VDSFormControlsColor.backgroundOndark + } + + private var radioBoxBorderColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight + $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark + + $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark + $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark + } - private var radioBoxBorderColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight - $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark - - $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark - $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() - //-------------------------------------------------- // MARK: - RadioBox View Updates //-------------------------------------------------- diff --git a/VDS/Components/RadioButton/RadioButton.swift b/VDS/Components/RadioButton/RadioButton.swift index cb2081c9..4a77cb48 100644 --- a/VDS/Components/RadioButton/RadioButton.swift +++ b/VDS/Components/RadioButton/RadioButton.swift @@ -240,8 +240,6 @@ open class RadioButtonBase: Control { // MARK: - State //-------------------------------------------------- open override func updateView(viewModel: ModelType) { - let enabled = !viewModel.disabled - updateLabels(viewModel) updateSelector(viewModel) setAccessibilityHint() @@ -256,43 +254,37 @@ open class RadioButtonBase: Control { //-------------------------------------------------- public let radioButtonSize = CGSize(width: 20, height: 20) public let radioButtonSelectedSize = CGSize(width: 10, height: 10) - - private var radioButtonBackgroundColorConfiguration: RadioButtonErrorColorConfiguration = { - return RadioButtonErrorColorConfiguration().with { - //error doesn't care enabled/disable - $0.error.forTrue.lightColor = VDSColor.elementsPrimaryOnlight - $0.error.forTrue.darkColor = VDSColor.elementsPrimaryOndark - $0.error.forFalse.lightColor = VDSColor.feedbackErrorBackgroundOnlight - $0.error.forFalse.darkColor = VDSColor.feedbackErrorBackgroundOndark - } - }() - private var radioButtonBorderColorConfiguration: RadioButtonErrorColorConfiguration = { - return RadioButtonErrorColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight - $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark - $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark - $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark - //error doesn't care enabled/disable - $0.error.forTrue.lightColor = VDSColor.elementsPrimaryOnlight - $0.error.forTrue.darkColor = VDSColor.elementsPrimaryOndark - $0.error.forFalse.lightColor = VDSColor.feedbackErrorOnlight - $0.error.forFalse.darkColor = VDSColor.feedbackErrorOndark - } - }() - - private var radioButtonCheckColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() + private var radioButtonBackgroundColorConfiguration = ErrorBinaryDisabledSurfaceColorConfiguration().with { + //error doesn't care enabled/disable + $0.error.forTrue.lightColor = VDSColor.elementsPrimaryOnlight + $0.error.forTrue.darkColor = VDSColor.elementsPrimaryOndark + $0.error.forFalse.lightColor = VDSColor.feedbackErrorBackgroundOnlight + $0.error.forFalse.darkColor = VDSColor.feedbackErrorBackgroundOndark + } + + private var radioButtonBorderColorConfiguration = ErrorBinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight + $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark + $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark + $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark + //error doesn't care enabled/disable + $0.error.forTrue.lightColor = VDSColor.elementsPrimaryOnlight + $0.error.forTrue.darkColor = VDSColor.elementsPrimaryOndark + $0.error.forFalse.lightColor = VDSColor.feedbackErrorOnlight + $0.error.forFalse.darkColor = VDSColor.feedbackErrorOndark + } + + private var radioButtonCheckColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark + } //-------------------------------------------------- // MARK: - RadioButton View @@ -338,23 +330,5 @@ open class RadioButtonBase: Control { shapeLayer.path = bezierPath.cgPath } } - - //-------------------------------------------------- - // MARK: - Color Class Configurations - //-------------------------------------------------- - private class RadioButtonErrorColorConfiguration: BinaryDisabledSurfaceColorConfiguration { - public let error = BinarySurfaceColorConfiguration() - override func getColor(_ viewModel: ModelType) -> UIColor { - //only show error is enabled and showError == true - let showErrorColor = !viewModel.disabled && viewModel.showError - - if showErrorColor { - return error.getColor(viewModel) - } else { - return super.getColor(viewModel) - } - } - } - } diff --git a/VDS/Components/RadioSwatch/RadioSwatch.swift b/VDS/Components/RadioSwatch/RadioSwatch.swift index 1d0e4164..c53e7079 100644 --- a/VDS/Components/RadioSwatch/RadioSwatch.swift +++ b/VDS/Components/RadioSwatch/RadioSwatch.swift @@ -159,41 +159,36 @@ open class RadioSwatchBase: Control { public let swatchSize = CGSize(width: 48, height: 48) public let fillSize = CGSize(width: 36, height: 36) public let disabledAlpha = 0.5 - private var radioSwatchBackgroundColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forFalse.enabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forFalse.enabled.darkColor = VDSFormControlsColor.backgroundOndark - $0.forFalse.disabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forFalse.disabled.darkColor = VDSFormControlsColor.backgroundOndark - - $0.forTrue.enabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forTrue.enabled.darkColor = VDSFormControlsColor.backgroundOndark - $0.forTrue.disabled.lightColor = VDSFormControlsColor.backgroundOnlight - $0.forTrue.disabled.darkColor = VDSFormControlsColor.backgroundOndark - } - }() - private var radioSwatchBorderColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight - $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark - $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark - $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() + private var radioSwatchBackgroundColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forFalse.enabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forFalse.enabled.darkColor = VDSFormControlsColor.backgroundOndark + $0.forFalse.disabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forFalse.disabled.darkColor = VDSFormControlsColor.backgroundOndark + $0.forTrue.enabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forTrue.enabled.darkColor = VDSFormControlsColor.backgroundOndark + $0.forTrue.disabled.lightColor = VDSFormControlsColor.backgroundOnlight + $0.forTrue.disabled.darkColor = VDSFormControlsColor.backgroundOndark + } + + private var radioSwatchBorderColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forFalse.enabled.lightColor = VDSFormControlsColor.borderOnlight + $0.forFalse.enabled.darkColor = VDSFormControlsColor.borderOndark + $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark + $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark + } + + private var radioSwatchFillBorderColorConfiguration = DisabledSurfaceColorConfiguration().with { + $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight + $0.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.disabled.darkColor = VDSColor.interactiveDisabledOndark + } - private var radioSwatchFillBorderColorConfiguration: DisabledSurfaceColorConfiguration = { - return DisabledSurfaceColorConfiguration().with { - $0.enabled.lightColor = VDSColor.elementsPrimaryOnlight - $0.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - }() //-------------------------------------------------- // MARK: - RadioBox View Updates //-------------------------------------------------- diff --git a/VDS/Components/Toggle/Toggle.swift b/VDS/Components/Toggle/Toggle.swift index 27d19634..8babbace 100644 --- a/VDS/Components/Toggle/Toggle.swift +++ b/VDS/Components/Toggle/Toggle.swift @@ -64,31 +64,27 @@ open class ToggleBase: Control { public let toggleContainerSize = CGSize(width: 52, height: 44) public let knobSize = CGSize(width: 20, height: 20) - private var toggleColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.paletteGreen26 - $0.forTrue.enabled.darkColor = VDSColor.paletteGreen34 - $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark - $0.forFalse.enabled.lightColor = VDSColor.elementsSecondaryOnlight - $0.forFalse.enabled.darkColor = VDSColor.paletteGray44 - $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight - $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark - } - } () + private var toggleColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.paletteGreen26 + $0.forTrue.enabled.darkColor = VDSColor.paletteGreen34 + $0.forTrue.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forTrue.disabled.darkColor = VDSColor.interactiveDisabledOndark + $0.forFalse.enabled.lightColor = VDSColor.elementsSecondaryOnlight + $0.forFalse.enabled.darkColor = VDSColor.paletteGray44 + $0.forFalse.disabled.lightColor = VDSColor.interactiveDisabledOnlight + $0.forFalse.disabled.darkColor = VDSColor.interactiveDisabledOndark + } - private var knobColorConfiguration: BinaryDisabledSurfaceColorConfiguration = { - return BinaryDisabledSurfaceColorConfiguration().with { - $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOndark - $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forTrue.disabled.lightColor = VDSColor.paletteGray95 - $0.forTrue.disabled.darkColor = VDSColor.paletteGray44 - $0.forFalse.enabled.lightColor = VDSColor.elementsPrimaryOndark - $0.forFalse.enabled.darkColor = VDSColor.elementsPrimaryOndark - $0.forFalse.disabled.lightColor = VDSColor.paletteGray95 - $0.forFalse.disabled.darkColor = VDSColor.paletteGray44 - } - } () + private var knobColorConfiguration = BinaryDisabledSurfaceColorConfiguration().with { + $0.forTrue.enabled.lightColor = VDSColor.elementsPrimaryOndark + $0.forTrue.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forTrue.disabled.lightColor = VDSColor.paletteGray95 + $0.forTrue.disabled.darkColor = VDSColor.paletteGray44 + $0.forFalse.enabled.lightColor = VDSColor.elementsPrimaryOndark + $0.forFalse.enabled.darkColor = VDSColor.elementsPrimaryOndark + $0.forFalse.disabled.lightColor = VDSColor.paletteGray95 + $0.forFalse.disabled.darkColor = VDSColor.paletteGray44 + } //-------------------------------------------------- // MARK: - Public Properties diff --git a/VDS/Protocols/Withable.swift b/VDS/Protocols/Withable.swift index 62af68ab..0ab9eebd 100644 --- a/VDS/Protocols/Withable.swift +++ b/VDS/Protocols/Withable.swift @@ -48,3 +48,4 @@ public extension Withable { return copy } } + From b61d4aece7b7459b6f13962a9ea20e69e01d3b63 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 10 Oct 2022 16:37:30 -0500 Subject: [PATCH 11/11] added cherry picked code Signed-off-by: Matt Bruce --- VDS.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VDS.xcodeproj/project.pbxproj b/VDS.xcodeproj/project.pbxproj index a34f8806..467e3ffb 100644 --- a/VDS.xcodeproj/project.pbxproj +++ b/VDS.xcodeproj/project.pbxproj @@ -59,6 +59,7 @@ EA89201328B568D8006B9984 /* RadioBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89201228B568D8006B9984 /* RadioBox.swift */; }; EA89201528B56CF4006B9984 /* RadioBoxGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89201428B56CF4006B9984 /* RadioBoxGroup.swift */; }; EA89201728B56CFF006B9984 /* RadioBoxGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89201628B56CFF006B9984 /* RadioBoxGroupModel.swift */; }; + EAA5EEE228F4C62C003B3210 /* Colorable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAA5EEE128F4C62C003B3210 /* Colorable.swift */; }; EAB1D29A28A5611D00DAE764 /* SelectorGroupModelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29928A5611D00DAE764 /* SelectorGroupModelable.swift */; }; EAB1D29C28A5618900DAE764 /* RadioButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */; }; EAB1D29E28A5619500DAE764 /* RadioButtonGroupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29D28A5619500DAE764 /* RadioButtonGroupModel.swift */; }; @@ -161,6 +162,7 @@ EA89201228B568D8006B9984 /* RadioBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioBox.swift; sourceTree = ""; }; EA89201428B56CF4006B9984 /* RadioBoxGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioBoxGroup.swift; sourceTree = ""; }; EA89201628B56CFF006B9984 /* RadioBoxGroupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioBoxGroupModel.swift; sourceTree = ""; }; + EAA5EEE128F4C62C003B3210 /* Colorable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Colorable.swift; sourceTree = ""; }; EAB1D29928A5611D00DAE764 /* SelectorGroupModelable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectorGroupModelable.swift; sourceTree = ""; }; EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonGroup.swift; sourceTree = ""; }; EAB1D29D28A5619500DAE764 /* RadioButtonGroupModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonGroupModel.swift; sourceTree = ""; }; @@ -341,6 +343,7 @@ children = ( EA3361C4289030FC0071C351 /* Accessable.swift */, EA4DB2FC28D3D0CA00103EE3 /* AnyEquatable.swift */, + EAA5EEE128F4C62C003B3210 /* Colorable.swift */, EA3361AC288B26190071C351 /* DataTrackable.swift */, EA3361A9288B25E40071C351 /* Disabling.swift */, EAF7F0A1289AFB3900B287F5 /* Errorable.swift */, @@ -685,6 +688,7 @@ EAF7F0B7289C12A600B287F5 /* UITapGestureRecognizer.swift in Sources */, EA3362452892F9130071C351 /* Labelable.swift in Sources */, EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */, + EAA5EEE228F4C62C003B3210 /* Colorable.swift in Sources */, EA33623E2892EE950071C351 /* UIDevice.swift in Sources */, EA3362302891EB4A0071C351 /* Fonts.swift in Sources */, EA1F265E28B944F00033E859 /* CollectionViewCell.swift in Sources */,