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
This commit is contained in:
Mariusz Klochowicz
2025-11-06 08:26:24 +10:30
committed by GitHub
parent 72dd7187f4
commit 936b095391
3 changed files with 4 additions and 2 deletions

View File

@@ -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;
};

View File

@@ -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

View File

@@ -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)
}