Fix some isolation errors when compiling with Swift 6.4. (#6148)

* Fix some isolation errors when compiling with Swift 6.4.

* Update the Design Tokens dependency to include Sendable conformances.
This commit is contained in:
Doug
2026-09-10 15:22:53 +01:00
committed by GitHub
parent a150df584d
commit 4608a63e29
11 changed files with 28 additions and 27 deletions
@@ -1,13 +1,13 @@
{ {
"originHash" : "792b23b07d60beec539354df3338b50d91cb38b47c8d2d9b3552f161843e0682", "originHash" : "f1791683f9f09408a7746ce0e163941b3ce7e83e84f1a73b2fecc2b5d2f2f4b6",
"pins" : [ "pins" : [
{ {
"identity" : "compound-design-tokens", "identity" : "compound-design-tokens",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/compound-design-tokens", "location" : "https://github.com/element-hq/compound-design-tokens",
"state" : { "state" : {
"revision" : "edc554adf951b0627ab68b197f7d86c786189e76", "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419",
"version" : "10.2.4" "version" : "11.0.0"
} }
}, },
{ {
@@ -8,12 +8,12 @@
import Foundation import Foundation
enum NetworkMonitorReachability { nonisolated enum NetworkMonitorReachability {
case reachable case reachable
case unreachable case unreachable
} }
enum HomeserverReachability { nonisolated enum HomeserverReachability {
/// The store is open and the homeserver is reachable. /// The store is open and the homeserver is reachable.
case reachable case reachable
/// The homeserver can't be reached even though we're trying to sync (i.e. offline). /// The homeserver can't be reached even though we're trying to sync (i.e. offline).
@@ -8,7 +8,7 @@
import SwiftUI import SwiftUI
struct RoundedCornerShape: Shape { nonisolated struct RoundedCornerShape: Shape {
let radius: CGFloat let radius: CGFloat
let corners: UIRectCorner let corners: UIRectCorner
@@ -84,7 +84,7 @@ private struct ViewSizeKey: PreferenceKey {
} }
} }
private struct WaveformShape: Shape { private nonisolated struct WaveformShape: Shape {
let lineWidth: CGFloat let lineWidth: CGFloat
let linePadding: CGFloat let linePadding: CGFloat
let waveformData: [Float] let waveformData: [Float]
@@ -159,7 +159,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
private func build(_ builder: ClientBuilder, private func build(_ builder: ClientBuilder,
for mode: BuildMode, for mode: BuildMode,
appHooks: AppHooks) async throws -> ClientProtocol { appHooks: AppHooks) async throws -> ClientProtocol {
var client: ClientProtocol = try await appHooks.clientFactoryHook.configure(builder, toRestore: mode.session).build() let client: ClientProtocol = try await appHooks.clientFactoryHook.configure(builder, toRestore: mode.session).build()
switch mode { switch mode {
case .authentication: case .authentication:
@@ -400,7 +400,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0; IPHONEOS_DEPLOYMENT_TARGET = 18.5;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@@ -434,7 +434,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.0; IPHONEOS_DEPLOYMENT_TARGET = 18.5;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@@ -1,13 +1,13 @@
{ {
"originHash" : "89c566dd1386002d6eb972c1cd428caf08db40d80235fb7bc4c296139b11e7c7", "originHash" : "7a6117b3894e217e5bc0fe7497b0b868c49d51f41e0d8be554dc766cb9566ec9",
"pins" : [ "pins" : [
{ {
"identity" : "compound-design-tokens", "identity" : "compound-design-tokens",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/compound-design-tokens", "location" : "https://github.com/element-hq/compound-design-tokens",
"state" : { "state" : {
"revision" : "edc554adf951b0627ab68b197f7d86c786189e76", "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419",
"version" : "10.2.4" "version" : "11.0.0"
} }
}, },
{ {
+3 -3
View File
@@ -1,13 +1,13 @@
{ {
"originHash" : "89c566dd1386002d6eb972c1cd428caf08db40d80235fb7bc4c296139b11e7c7", "originHash" : "7a6117b3894e217e5bc0fe7497b0b868c49d51f41e0d8be554dc766cb9566ec9",
"pins" : [ "pins" : [
{ {
"identity" : "compound-design-tokens", "identity" : "compound-design-tokens",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/compound-design-tokens", "location" : "https://github.com/element-hq/compound-design-tokens",
"state" : { "state" : {
"revision" : "edc554adf951b0627ab68b197f7d86c786189e76", "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419",
"version" : "10.2.4" "version" : "11.0.0"
} }
}, },
{ {
+3 -3
View File
@@ -4,13 +4,13 @@ import PackageDescription
let package = Package( let package = Package(
name: "Compound", name: "Compound",
platforms: [.iOS(.v17)], platforms: [.iOS(.v18)],
products: [ products: [
.library(name: "Compound", targets: ["Compound"]) .library(name: "Compound", targets: ["Compound"])
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/element-hq/compound-design-tokens", exact: "10.2.4"), .package(url: "https://github.com/element-hq/compound-design-tokens", exact: "11.0.0"),
// .package(path: "../compound-design-tokens"), // .package(path: "../../compound-design-tokens"),
.package(url: "https://github.com/siteline/SwiftUI-Introspect", exact: "26.0.2"), .package(url: "https://github.com/siteline/SwiftUI-Introspect", exact: "26.0.2"),
.package(url: "https://github.com/SFSafeSymbols/SFSafeSymbols", exact: "7.0.0"), .package(url: "https://github.com/SFSafeSymbols/SFSafeSymbols", exact: "7.0.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.19.4") .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.19.4")
@@ -7,11 +7,12 @@
// //
import CompoundDesignTokens import CompoundDesignTokens
import Synchronization
import UIKit import UIKit
public extension UIColor { public extension UIColor {
/// The colours used by Element as defined in Compound Design Tokens. /// The colours used by Element as defined in Compound Design Tokens.
static let compound = CompoundUIColors() nonisolated static let compound = CompoundUIColors()
} }
/// The colours used by Element as defined in Compound Design Tokens. /// The colours used by Element as defined in Compound Design Tokens.
@@ -20,7 +21,7 @@ public extension UIColor {
/// The object needs to be nonisolated. /// The object needs to be nonisolated.
@Observable @Observable
@dynamicMemberLookup @dynamicMemberLookup
public final nonisolated class CompoundUIColors { public final nonisolated class CompoundUIColors: Sendable {
/// The base colour tokens that form the palette of available colours. /// The base colour tokens that form the palette of available colours.
/// ///
/// Normally these shouldn't be necessary, however in practice we may need /// Normally these shouldn't be necessary, however in practice we may need
@@ -29,16 +30,16 @@ public final nonisolated class CompoundUIColors {
/// The main semantic tokens generated from the Style Dictionary. /// The main semantic tokens generated from the Style Dictionary.
private let tokens = CompoundUIColorTokens() private let tokens = CompoundUIColorTokens()
/// Runtime overrides for the `tokens` property. /// Runtime overrides for the `tokens` property.
private var overrides = [KeyPath<CompoundUIColorTokens, UIColor>: UIColor]() private let overrides = Mutex<[KeyPath<CompoundUIColorTokens, UIColor> & Sendable: UIColor]>(.init())
public subscript(dynamicMember keyPath: KeyPath<CompoundUIColorTokens, UIColor>) -> UIColor { public subscript(dynamicMember keyPath: KeyPath<CompoundUIColorTokens, UIColor> & Sendable) -> UIColor {
overrides[keyPath] ?? tokens[keyPath: keyPath] overrides.withLock { $0[keyPath] } ?? tokens[keyPath: keyPath]
} }
/// Customise the colour at the specified key path with the supplied colour. /// Customise the colour at the specified key path with the supplied colour.
/// Supplying `nil` as the colour will remove any existing customisation. /// Supplying `nil` as the colour will remove any existing customisation.
public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor>, with color: UIColor?) { public func override(_ keyPath: KeyPath<CompoundUIColorTokens, UIColor> & Sendable, with color: UIColor?) {
overrides[keyPath] = color overrides.withLock { $0[keyPath] = color }
} }
// MARK: - Awaiting Semantic Tokens // MARK: - Awaiting Semantic Tokens