From 052d7b57b02a1c226cfc44080a448ac1ff69398a Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 22 Aug 2022 17:42:59 -0500 Subject: [PATCH] created public init Signed-off-by: Matt Bruce --- VDS/Classes/ColorConfiguration.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/VDS/Classes/ColorConfiguration.swift b/VDS/Classes/ColorConfiguration.swift index 1562b04e..581c38e6 100644 --- a/VDS/Classes/ColorConfiguration.swift +++ b/VDS/Classes/ColorConfiguration.swift @@ -8,7 +8,7 @@ import Foundation import UIKit -public protocol Colorable: Withable { +public protocol Colorable: Withable, Initable { associatedtype ModelType func getColor(_ viewModel: ModelType) -> UIColor } @@ -33,6 +33,7 @@ open class SurfaceColorConfiguration: Colorable { public var lightColor: UIColor = .clear public var darkColor: UIColor = .clear + required public init(){} public func getColor(_ viewModel: ModelType) -> UIColor { return viewModel.surface == .light ? lightColor : darkColor } @@ -63,6 +64,8 @@ open class DisabledSurfaceColorConfiguration: 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) } @@ -92,6 +95,8 @@ open class BinarySurfaceColorConfiguration() public var forFalse = SurfaceColorConfiguration() + required public init(){} + public func getColor(_ viewModel: ModelType) -> UIColor { return viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) } @@ -125,6 +130,8 @@ open class BinaryDisabledSurfaceColorConfiguration() public var forFalse = DisabledSurfaceColorConfiguration() + required public init(){} + public func getColor(_ viewModel: ModelType) -> UIColor { return viewModel.userTrueColor ? forTrue.getColor(viewModel) : forFalse.getColor(viewModel) }