Skip to content

Commit

Permalink
Add more Sendable conformances to resolve warnings (#309)
Browse files Browse the repository at this point in the history
Resolves warnings that appear when compiling with Xcode 16 / Swift 6.

These warnings can be seen in
https://github.com/connectrpc/connect-swift/actions/runs/11248587333.

Signed-off-by: Michael Rebello <[email protected]>
  • Loading branch information
rebello95 authored Oct 9, 2024
1 parent 5b7ea4d commit 7bbb10b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Foundation
@available(iOS 13, *)
final class ClientOnlyAsyncStream<
Input: ProtobufMessage, Output: ProtobufMessage
>: BidirectionalAsyncStream<Input, Output> {
>: BidirectionalAsyncStream<Input, Output>, @unchecked Sendable {
private let receivedResults = Locked([StreamResult<Output>]())

override func handleResultFromServer(_ result: StreamResult<Output>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SwiftProtobuf

/// Represents a bidirectional stream that can be interacted with using async/await.
@available(iOS 13, *)
public protocol BidirectionalAsyncStreamInterface<Input, Output> {
public protocol BidirectionalAsyncStreamInterface<Input, Output>: Sendable {
/// The input (request) message type.
associatedtype Input: ProtobufMessage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SwiftProtobuf
/// Represents a client-only stream (a stream where the client streams data to the server and
/// eventually receives a response) that can be interacted with using async/await.
@available(iOS 13, *)
public protocol ClientOnlyAsyncStreamInterface<Input, Output> {
public protocol ClientOnlyAsyncStreamInterface<Input, Output>: Sendable {
/// The input (request) message type.
associatedtype Input: ProtobufMessage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SwiftProtobuf
/// Represents a server-only stream (a stream where the server streams data to the client after
/// receiving an initial request) that can be interacted with using async/await.
@available(iOS 13, *)
public protocol ServerOnlyAsyncStreamInterface<Input, Output> {
public protocol ServerOnlyAsyncStreamInterface<Input, Output>: Sendable {
/// The input (request) message type.
associatedtype Input: ProtobufMessage

Expand Down
2 changes: 1 addition & 1 deletion Libraries/ConnectNIO/Public/NIOHTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Connect
import Foundation
import NIOConcurrencyHelpers
import NIOCore
@preconcurrency import NIOCore // TODO: Convert to normal import once `ChannelHandler` is `Sendable`
import NIOHTTP1
import NIOHTTP2
import NIOPosix
Expand Down
2 changes: 1 addition & 1 deletion Tests/ConformanceClient/Sources/ConformanceInvoker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftProtobuf

/// Class responsible for running a specific conformance test case against a service.
@available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *)
final class ConformanceInvoker {
final class ConformanceInvoker: Sendable {
private let client: ConformanceClient
private let context: ConformanceRequest

Expand Down

0 comments on commit 7bbb10b

Please sign in to comment.