From 999576b0c5802a67718c3954ac0d3342e49bb573 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Tue, 24 Feb 2026 12:55:46 -0800 Subject: [PATCH 1/2] Enable Swift 6 for KDS --- KDS/Package.swift | 3 --- KDS/Sources/KDS/Colors/SemanticColor.swift | 6 +++--- KDS/Sources/KDS/Controllers/ColorsView.swift | 4 ++-- KDS/Sources/KDS/Fonts/InterFont.swift | 12 ++++++++---- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/KDS/Package.swift b/KDS/Package.swift index 7b13f18d17..fba98b0cd0 100644 --- a/KDS/Package.swift +++ b/KDS/Package.swift @@ -34,8 +34,5 @@ let package = Package( .product(name: "SnapshotTesting", package: "swift-snapshot-testing") ] ) - ], - swiftLanguageModes: [ - .v5 ] ) diff --git a/KDS/Sources/KDS/Colors/SemanticColor.swift b/KDS/Sources/KDS/Colors/SemanticColor.swift index 1d48a6046a..94857df181 100644 --- a/KDS/Sources/KDS/Colors/SemanticColor.swift +++ b/KDS/Sources/KDS/Colors/SemanticColor.swift @@ -1,7 +1,7 @@ import SwiftUI import UIKit -public protocol AdaptiveColor { +public protocol AdaptiveColor: Sendable { /// Returns a dynamically-provided `UIColor`, which responds to light/dark mode. var dynamicColor: UIColor { get } } @@ -30,7 +30,7 @@ public extension AdaptiveColor { /// A semantic color from the Kickstarter design system, like "surface/primary". /// Includes a light and dark mode color pair, as well as an identifying title. -public struct SemanticColor: AdaptiveColor { +public struct SemanticColor: AdaptiveColor, Sendable { public let dynamicColor: UIColor public let name: String @@ -62,7 +62,7 @@ public struct SemanticColor: AdaptiveColor { } /// Used for old design system colors which can't be mapped directly to the Kickstarter color palette. -public struct LegacyColor: AdaptiveColor { +public struct LegacyColor: AdaptiveColor, Sendable { public let name: String public let dynamicColor: UIColor diff --git a/KDS/Sources/KDS/Controllers/ColorsView.swift b/KDS/Sources/KDS/Controllers/ColorsView.swift index f2575caa6c..924122a5fa 100644 --- a/KDS/Sources/KDS/Controllers/ColorsView.swift +++ b/KDS/Sources/KDS/Controllers/ColorsView.swift @@ -176,13 +176,13 @@ public struct ColorsView: View { } } -extension SemanticColor: @retroactive Identifiable { +extension SemanticColor: Identifiable { public var id: String { return self.name } } -extension LegacyColor: @retroactive Identifiable { +extension LegacyColor: Identifiable { public var id: String { return self.name } diff --git a/KDS/Sources/KDS/Fonts/InterFont.swift b/KDS/Sources/KDS/Fonts/InterFont.swift index 065aabaf92..592b443073 100644 --- a/KDS/Sources/KDS/Fonts/InterFont.swift +++ b/KDS/Sources/KDS/Fonts/InterFont.swift @@ -1,3 +1,4 @@ +import Synchronization import UIKit public enum InterFont: CustomFont, CaseIterable { @@ -75,15 +76,18 @@ public enum InterFont: CustomFont, CaseIterable { } } -var registeredInterfont = false - extension InterFont: CustomFontAccessible { + private static let registeredInterfont = Mutex(false) public static var isRegistered: Bool { get { - registeredInterfont + registeredInterfont.withLock { isRegistered in + isRegistered + } } set { - registeredInterfont = newValue + registeredInterfont.withLock { isRegistered in + isRegistered = newValue + } } } From 572c7e1a5b80cead47bb5250dabb1c6a65302da4 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Tue, 24 Feb 2026 13:55:13 -0800 Subject: [PATCH 2/2] Use an Atomic rather than a Mutex --- KDS/Sources/KDS/Fonts/InterFont.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/KDS/Sources/KDS/Fonts/InterFont.swift b/KDS/Sources/KDS/Fonts/InterFont.swift index 592b443073..0f1bebc63c 100644 --- a/KDS/Sources/KDS/Fonts/InterFont.swift +++ b/KDS/Sources/KDS/Fonts/InterFont.swift @@ -77,17 +77,13 @@ public enum InterFont: CustomFont, CaseIterable { } extension InterFont: CustomFontAccessible { - private static let registeredInterfont = Mutex(false) + private static let registeredInterfont = Atomic(false) public static var isRegistered: Bool { get { - registeredInterfont.withLock { isRegistered in - isRegistered - } + registeredInterfont.load(ordering: .acquiring) } set { - registeredInterfont.withLock { isRegistered in - isRegistered = newValue - } + _ = registeredInterfont.exchange(newValue, ordering: .acquiringAndReleasing) } }