From 936b09539186464cb65f02fea7bae0377bc85a1c Mon Sep 17 00:00:00 2001 From: Mariusz Klochowicz Date: Thu, 6 Nov 2025 08:26:24 +1030 Subject: [PATCH] chore(apple): Enable Swift 6.2 Approachable Concurrency features (#10799) Enables SWIFT_APPROACHABLE_CONCURRENCY build setting which activates a few key Swift 6.2 concurrency features, including: 1. NonisolatedNonsendingByDefault - Makes nonisolated async functions run on the caller's executor instead of the global executor, providing more predictable performance and behaviour 2. InferIsolatedConformances - Protocol conformances automatically inherit global actor isolation, reducing annotation burden Read more: https://www.donnywals.com/what-is-approachable-concurrency-in-xcode-26/ Also bumps swift-tools-version from 6.0 to 6.2 in Package.swift to enable newer Package Manager manifest APIs. As a result of better type inference, removes 1 redundant @Sendable annotation in Store.swift: - vpnStatusChangeHandler: @MainActor closures are implicitly Sendable --- swift/apple/Firezone.xcodeproj/project.pbxproj | 2 ++ swift/apple/FirezoneKit/Package.swift | 2 +- swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/swift/apple/Firezone.xcodeproj/project.pbxproj b/swift/apple/Firezone.xcodeproj/project.pbxproj index 587b8b827..1ebec2226 100644 --- a/swift/apple/Firezone.xcodeproj/project.pbxproj +++ b/swift/apple/Firezone.xcodeproj/project.pbxproj @@ -793,6 +793,7 @@ SUPPORTED_PLATFORMS = "macosx iphoneos"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_STRICT_CONCURRENCY = complete; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; }; @@ -857,6 +858,7 @@ SUPPORTED_PLATFORMS = "macosx iphoneos"; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_STRICT_CONCURRENCY = complete; SWIFT_TREAT_WARNINGS_AS_ERRORS = YES; }; diff --git a/swift/apple/FirezoneKit/Package.swift b/swift/apple/FirezoneKit/Package.swift index 39ff025d1..1e30f1b57 100644 --- a/swift/apple/FirezoneKit/Package.swift +++ b/swift/apple/FirezoneKit/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 6.0 +// swift-tools-version: 6.2 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift b/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift index 56359143a..e81e6ff0d 100644 --- a/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift +++ b/swift/apple/FirezoneKit/Sources/FirezoneKit/Stores/Store.swift @@ -110,7 +110,7 @@ public final class Store: ObservableObject { #endif private func setupTunnelObservers() async throws { - let vpnStatusChangeHandler: @Sendable (NEVPNStatus) async throws -> Void = { + let vpnStatusChangeHandler: @MainActor (NEVPNStatus) async throws -> Void = { [weak self] status in try await self?.handleVPNStatusChange(newVPNStatus: status) }