From 63d5b97de6a2ca8e1d0f2c86f4b06adb7ecfbfee Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 1 Aug 2022 12:05:49 -0500 Subject: [PATCH] refactored color to surface Signed-off-by: Matt Bruce --- VDS/Components/Toggle/VDSToggle.swift | 2 +- VDS/Protocols/Surfaceable.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VDS/Components/Toggle/VDSToggle.swift b/VDS/Components/Toggle/VDSToggle.swift index 34a6c275..c569597f 100644 --- a/VDS/Components/Toggle/VDSToggle.swift +++ b/VDS/Components/Toggle/VDSToggle.swift @@ -377,7 +377,7 @@ import Combine }, completion: nil) } - backgroundColor = viewModel.surface == .dark ? VDSColor.backgroundPrimaryDark : .clear + backgroundColor = viewModel.surface.color isUserInteractionEnabled = !viewModel.disabled setAccessibilityHint(enabled) diff --git a/VDS/Protocols/Surfaceable.swift b/VDS/Protocols/Surfaceable.swift index 4988a146..c00fd04c 100644 --- a/VDS/Protocols/Surfaceable.swift +++ b/VDS/Protocols/Surfaceable.swift @@ -6,9 +6,14 @@ // import Foundation +import UIKit +import VDSColorTokens public enum Surface: String, Codable { case light, dark + public var color: UIColor { + return self == .dark ? VDSColor.backgroundPrimaryDark : .clear + } } public protocol Surfaceable {