diff --git a/Sources/NIOCore/ByteBuffer-aux.swift b/Sources/NIOCore/ByteBuffer-aux.swift index 1e0cfa18f..5555941cb 100644 --- a/Sources/NIOCore/ByteBuffer-aux.swift +++ b/Sources/NIOCore/ByteBuffer-aux.swift @@ -964,7 +964,7 @@ extension ByteBuffer { /// - Returns: A `String` value containing the UTF-8 decoded selected bytes from this `ByteBuffer` or `nil` if /// the requested bytes are not readable. @inlinable - @available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) + @available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) public func getUTF8ValidatedString(at index: Int, length: Int) throws -> String? { guard let slice = self.getSlice(at: index, length: length) else { return nil @@ -990,7 +990,7 @@ extension ByteBuffer { /// - length: The number of bytes making up the string. /// - Returns: A `String` value deserialized from this `ByteBuffer` or `nil` if there aren't at least `length` bytes readable. @inlinable - @available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) + @available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) public mutating func readUTF8ValidatedString(length: Int) throws -> String? { guard let result = try self.getUTF8ValidatedString(at: self.readerIndex, length: length) else { return nil @@ -1019,7 +1019,7 @@ extension ByteBuffer { /// - Returns: A validated String, or `nil` if the requested bytes are not readable. /// - Throws: `ReadUTF8ValidationError.invalidUTF8` if the bytes are not valid UTF8. @inlinable - @available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) + @available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) public func peekUTF8ValidatedString(length: Int) throws -> String? { try self.getUTF8ValidatedString(at: self.readerIndex, length: length) } diff --git a/Sources/NIOFileSystem/Array+FileSystem.swift b/Sources/NIOFileSystem/Array+FileSystem.swift index b8707fbbd..3f850514f 100644 --- a/Sources/NIOFileSystem/Array+FileSystem.swift +++ b/Sources/NIOFileSystem/Array+FileSystem.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android) +#if canImport(Darwin) || os(Linux) || os(Android) import NIOCore @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) diff --git a/Sources/NIOFileSystem/ArraySlice+FileSystem.swift b/Sources/NIOFileSystem/ArraySlice+FileSystem.swift index 37e324acf..550bab2bc 100644 --- a/Sources/NIOFileSystem/ArraySlice+FileSystem.swift +++ b/Sources/NIOFileSystem/ArraySlice+FileSystem.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android) +#if canImport(Darwin) || os(Linux) || os(Android) import NIOCore @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) diff --git a/Sources/NIOFileSystem/IOStrategy.swift b/Sources/NIOFileSystem/IOStrategy.swift index fcb7fb432..5bf673e31 100644 --- a/Sources/NIOFileSystem/IOStrategy.swift +++ b/Sources/NIOFileSystem/IOStrategy.swift @@ -44,7 +44,7 @@ enum IOStrategy: Hashable, Sendable { // // Anyone tuning this is encouraged to cover worst case scenarios. return .parallel(8) - #elseif os(iOS) || os(tvOS) || os(watchOS) || os(Android) + #elseif (canImport(Darwin) && !os(macOS)) || os(Android) // Reduced maximum descriptors in embedded world. This is chosen based on biasing towards // safety, not empirical testing. return .parallel(4) diff --git a/Sources/NIOFileSystemFoundationCompat/Data+FileSystem.swift b/Sources/NIOFileSystemFoundationCompat/Data+FileSystem.swift index 7e0652f24..7c5ee80e6 100644 --- a/Sources/NIOFileSystemFoundationCompat/Data+FileSystem.swift +++ b/Sources/NIOFileSystemFoundationCompat/Data+FileSystem.swift @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Linux) || os(Android) +#if canImport(Darwin) || os(Linux) || os(Android) import _NIOFileSystem import NIOCore import NIOFoundationCompat diff --git a/Tests/NIOCoreTests/ByteBufferTest.swift b/Tests/NIOCoreTests/ByteBufferTest.swift index ff395f4c4..24e310c2e 100644 --- a/Tests/NIOCoreTests/ByteBufferTest.swift +++ b/Tests/NIOCoreTests/ByteBufferTest.swift @@ -1317,7 +1317,7 @@ class ByteBufferTest: XCTestCase { func testReadUTF8ValidatedString() throws { #if compiler(>=6) - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") } buf.clear() @@ -1334,7 +1334,7 @@ class ByteBufferTest: XCTestCase { func testGetUTF8ValidatedString() throws { #if compiler(>=6) - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'getUTF8ValidatedString' is only available in Swift 6 and later") } buf.clear() @@ -1349,7 +1349,7 @@ class ByteBufferTest: XCTestCase { func testReadUTF8InvalidString() throws { #if compiler(>=6) - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") } buf.clear() @@ -4229,7 +4229,7 @@ extension ByteBufferTest { #if compiler(>=6) func testPeekUTF8ValidatedString_Normal() throws { - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'peekUTF8ValidatedString' is only available in Swift 6 and later") } var buffer = ByteBuffer() @@ -4241,7 +4241,7 @@ extension ByteBufferTest { } func testPeekUTF8ValidatedString_Empty() throws { - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'peekUTF8ValidatedString' is only available in Swift 6 and later") } var buffer = ByteBuffer() @@ -4252,7 +4252,7 @@ extension ByteBufferTest { } func testPeekUTF8ValidatedString_Repeated() throws { - guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, *) else { + guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'peekUTF8ValidatedString' is only available in Swift 6 and later") } var buffer = ByteBuffer()