From 76454b277159489c3c28b474fd8e19c4198f2e1f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Dec 2022 11:49:37 -0600 Subject: [PATCH] fixed bug in flipping colors Signed-off-by: Matt Bruce --- VDS/Components/Tilet/Tilet.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/VDS/Components/Tilet/Tilet.swift b/VDS/Components/Tilet/Tilet.swift index 117c185f..dea145af 100644 --- a/VDS/Components/Tilet/Tilet.swift +++ b/VDS/Components/Tilet/Tilet.swift @@ -59,6 +59,17 @@ open class Tilet: TileContainer { // MARK: - Public Properties //-------------------------------------------------- private var titleLockup = TitleLockup() + open override var surface: Surface { + didSet { + //flip the color + let flippedColor:ContainerBackgroundColor = surface == .dark ? .white : .black + containerBackgroundColor = flippedColor + + //flip the surface for the titleLockup + let flippedSurface: Surface = surface == .dark ? .light : .dark + titleLockup.surface = flippedSurface + } + } //-------------------------------------------------- // MARK: - Public Properties @@ -87,6 +98,7 @@ open class Tilet: TileContainer { open override func setup() { super.setup() + surface = .light addContentView(titleLockup) contentViewWithConstraint = titleLockup.widthAnchor.constraint(equalToConstant: width - (padding * 2)) contentViewWithConstraint?.isActive = true