From 4608a63e292b92da1121b1d70d4ff24d44f42f5e Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 10 Sep 2026 15:22:53 +0100 Subject: [PATCH] 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. --- .../xcshareddata/swiftpm/Package.resolved | 6 +++--- .../NetworkMonitor/NetworkMonitorProtocol.swift | 4 ++-- .../Other/SwiftUI/Views/RoundedCornerShape.swift | 2 +- .../VoiceMessage/EstimatedWaveformView.swift | 2 +- .../Sources/Services/Client/ClientFactory.swift | 2 +- Enterprise | 2 +- .../Inspector/Inspector.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 6 +++--- compound-ios/Package.resolved | 6 +++--- compound-ios/Package.swift | 6 +++--- .../Compound/Colors/CompoundUIColors.swift | 15 ++++++++------- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a765c0766..c8419c5a4 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "792b23b07d60beec539354df3338b50d91cb38b47c8d2d9b3552f161843e0682", + "originHash" : "f1791683f9f09408a7746ce0e163941b3ce7e83e84f1a73b2fecc2b5d2f2f4b6", "pins" : [ { "identity" : "compound-design-tokens", "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/compound-design-tokens", "state" : { - "revision" : "edc554adf951b0627ab68b197f7d86c786189e76", - "version" : "10.2.4" + "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419", + "version" : "11.0.0" } }, { diff --git a/ElementX/Sources/Other/NetworkMonitor/NetworkMonitorProtocol.swift b/ElementX/Sources/Other/NetworkMonitor/NetworkMonitorProtocol.swift index 0f1ae5b89..5c2fae7d4 100644 --- a/ElementX/Sources/Other/NetworkMonitor/NetworkMonitorProtocol.swift +++ b/ElementX/Sources/Other/NetworkMonitor/NetworkMonitorProtocol.swift @@ -8,12 +8,12 @@ import Foundation -enum NetworkMonitorReachability { +nonisolated enum NetworkMonitorReachability { case reachable case unreachable } -enum HomeserverReachability { +nonisolated enum HomeserverReachability { /// The store is open and the homeserver is reachable. case reachable /// The homeserver can't be reached even though we're trying to sync (i.e. offline). diff --git a/ElementX/Sources/Other/SwiftUI/Views/RoundedCornerShape.swift b/ElementX/Sources/Other/SwiftUI/Views/RoundedCornerShape.swift index 7ec3d5e08..b65507793 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/RoundedCornerShape.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/RoundedCornerShape.swift @@ -8,7 +8,7 @@ import SwiftUI -struct RoundedCornerShape: Shape { +nonisolated struct RoundedCornerShape: Shape { let radius: CGFloat let corners: UIRectCorner diff --git a/ElementX/Sources/Other/VoiceMessage/EstimatedWaveformView.swift b/ElementX/Sources/Other/VoiceMessage/EstimatedWaveformView.swift index 9280e35e1..46af5100e 100644 --- a/ElementX/Sources/Other/VoiceMessage/EstimatedWaveformView.swift +++ b/ElementX/Sources/Other/VoiceMessage/EstimatedWaveformView.swift @@ -84,7 +84,7 @@ private struct ViewSizeKey: PreferenceKey { } } -private struct WaveformShape: Shape { +private nonisolated struct WaveformShape: Shape { let lineWidth: CGFloat let linePadding: CGFloat let waveformData: [Float] diff --git a/ElementX/Sources/Services/Client/ClientFactory.swift b/ElementX/Sources/Services/Client/ClientFactory.swift index ecc8155e5..5e7553fd5 100644 --- a/ElementX/Sources/Services/Client/ClientFactory.swift +++ b/ElementX/Sources/Services/Client/ClientFactory.swift @@ -159,7 +159,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol { private func build(_ builder: ClientBuilder, for mode: BuildMode, 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 { case .authentication: diff --git a/Enterprise b/Enterprise index 30d2ad29a..adca548af 160000 --- a/Enterprise +++ b/Enterprise @@ -1 +1 @@ -Subproject commit 30d2ad29a8b75e40a245a60e11db1183b352302a +Subproject commit adca548afebc930931b5652051d7d970bf9338e4 diff --git a/compound-ios/Inspector/Inspector.xcodeproj/project.pbxproj b/compound-ios/Inspector/Inspector.xcodeproj/project.pbxproj index 22154fc5e..70afffd8d 100644 --- a/compound-ios/Inspector/Inspector.xcodeproj/project.pbxproj +++ b/compound-ios/Inspector/Inspector.xcodeproj/project.pbxproj @@ -400,7 +400,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -434,7 +434,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; + IPHONEOS_DEPLOYMENT_TARGET = 18.5; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/compound-ios/Inspector/Inspector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/compound-ios/Inspector/Inspector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 32715988d..15a19435e 100644 --- a/compound-ios/Inspector/Inspector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/compound-ios/Inspector/Inspector.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "89c566dd1386002d6eb972c1cd428caf08db40d80235fb7bc4c296139b11e7c7", + "originHash" : "7a6117b3894e217e5bc0fe7497b0b868c49d51f41e0d8be554dc766cb9566ec9", "pins" : [ { "identity" : "compound-design-tokens", "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/compound-design-tokens", "state" : { - "revision" : "edc554adf951b0627ab68b197f7d86c786189e76", - "version" : "10.2.4" + "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419", + "version" : "11.0.0" } }, { diff --git a/compound-ios/Package.resolved b/compound-ios/Package.resolved index 32715988d..15a19435e 100644 --- a/compound-ios/Package.resolved +++ b/compound-ios/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "89c566dd1386002d6eb972c1cd428caf08db40d80235fb7bc4c296139b11e7c7", + "originHash" : "7a6117b3894e217e5bc0fe7497b0b868c49d51f41e0d8be554dc766cb9566ec9", "pins" : [ { "identity" : "compound-design-tokens", "kind" : "remoteSourceControl", "location" : "https://github.com/element-hq/compound-design-tokens", "state" : { - "revision" : "edc554adf951b0627ab68b197f7d86c786189e76", - "version" : "10.2.4" + "revision" : "86c15ef71798581d1e0cc39a7f99e598ad572419", + "version" : "11.0.0" } }, { diff --git a/compound-ios/Package.swift b/compound-ios/Package.swift index 43ae5b12e..81bb70095 100644 --- a/compound-ios/Package.swift +++ b/compound-ios/Package.swift @@ -4,13 +4,13 @@ import PackageDescription let package = Package( name: "Compound", - platforms: [.iOS(.v17)], + platforms: [.iOS(.v18)], products: [ .library(name: "Compound", targets: ["Compound"]) ], dependencies: [ - .package(url: "https://github.com/element-hq/compound-design-tokens", exact: "10.2.4"), - // .package(path: "../compound-design-tokens"), + .package(url: "https://github.com/element-hq/compound-design-tokens", exact: "11.0.0"), + // .package(path: "../../compound-design-tokens"), .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/pointfreeco/swift-snapshot-testing", exact: "1.19.4") diff --git a/compound-ios/Sources/Compound/Colors/CompoundUIColors.swift b/compound-ios/Sources/Compound/Colors/CompoundUIColors.swift index f886a6ae9..1c2bab24a 100644 --- a/compound-ios/Sources/Compound/Colors/CompoundUIColors.swift +++ b/compound-ios/Sources/Compound/Colors/CompoundUIColors.swift @@ -7,11 +7,12 @@ // import CompoundDesignTokens +import Synchronization import UIKit public extension UIColor { /// 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. @@ -20,7 +21,7 @@ public extension UIColor { /// The object needs to be nonisolated. @Observable @dynamicMemberLookup -public final nonisolated class CompoundUIColors { +public final nonisolated class CompoundUIColors: Sendable { /// The base colour tokens that form the palette of available colours. /// /// 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. private let tokens = CompoundUIColorTokens() /// Runtime overrides for the `tokens` property. - private var overrides = [KeyPath: UIColor]() + private let overrides = Mutex<[KeyPath & Sendable: UIColor]>(.init()) - public subscript(dynamicMember keyPath: KeyPath) -> UIColor { - overrides[keyPath] ?? tokens[keyPath: keyPath] + public subscript(dynamicMember keyPath: KeyPath & Sendable) -> UIColor { + overrides.withLock { $0[keyPath] } ?? tokens[keyPath: keyPath] } /// Customise the colour at the specified key path with the supplied colour. /// Supplying `nil` as the colour will remove any existing customisation. - public func override(_ keyPath: KeyPath, with color: UIColor?) { - overrides[keyPath] = color + public func override(_ keyPath: KeyPath & Sendable, with color: UIColor?) { + overrides.withLock { $0[keyPath] = color } } // MARK: - Awaiting Semantic Tokens