diff --git a/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift b/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift index 16e4e3e..6e7e391 100644 --- a/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift +++ b/Sources/HTTPTypesFoundation/URLSession+HTTPTypes.swift @@ -44,7 +44,7 @@ private enum HTTPTypeConversionError: Error { #endif -#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || compiler(>=6) @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) extension URLSession { @@ -113,7 +113,14 @@ extension URLSession { } return (location, response) } +} +#endif + +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) + +@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) +extension URLSession { /// Returns a byte stream that conforms to AsyncSequence protocol. /// /// - Parameter request: The `HTTPRequest` for which to load data. @@ -131,6 +138,10 @@ extension URLSession { } } +#endif + +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) || compiler(>=6) + @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) extension URLSession { /// Convenience method to load data using an `HTTPRequest`; creates and resumes a `URLSessionDataTask` internally.