From de5ea3d0b49fcc6d0d15de01dd57a6213932f27f Mon Sep 17 00:00:00 2001 From: David Nadoba Date: Thu, 13 Oct 2022 14:47:28 +0100 Subject: [PATCH] Fix Swift 5.5 (#162) --- Sources/NIOTransportServices/NIOTSNetworkEvents.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/NIOTransportServices/NIOTSNetworkEvents.swift b/Sources/NIOTransportServices/NIOTSNetworkEvents.swift index df23273..30fc30f 100644 --- a/Sources/NIOTransportServices/NIOTSNetworkEvents.swift +++ b/Sources/NIOTransportServices/NIOTSNetworkEvents.swift @@ -103,6 +103,10 @@ public enum NIOTSNetworkEvents { } } +// Network.framework has not adopted `Sendable` yet. +// We therefore need to import it with `@preconcurrency`. +// `@preconcurrency` is only available in Swift 5.6. +#if swift(>=5.6) @available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) extension NIOTSNetworkEvents.BetterPathAvailable: Sendable {} @available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) @@ -115,5 +119,6 @@ extension NIOTSNetworkEvents.ConnectToNWEndpoint: Sendable {} extension NIOTSNetworkEvents.BindToNWEndpoint: Sendable {} @available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) extension NIOTSNetworkEvents.WaitingForConnectivity: Sendable {} +#endif #endif