Hello,
I have a peer to peer networking setup in my app that uses Network Framework with Bonjour and QUIC via NWBrowser, NWListener, NWConnection, and NWEndpoint and all works as expected.
I watched the videos about the new iOS 26 Networking stuff (NetworkBrowser, NetworkListener, NetworkConnection) and wanted to try and migrate all my code to use the the new APIs (still use Bonjour and NOT use Wi-Fi Aware) but hit some issues. I was following how the Wi-Fi Aware example app was receiving messages
for try await messageData in connection.messages {
but when I got things setup with QUIC in a similar fashion I got the following compile error
Requirement from conditional conformance of '(content: QUIC.ContentType, metadata: QUIC.Metadata)' to 'Copyable'
Requirement from conditional conformance of '(content: QUIC.ContentType, metadata: QUIC.Metadata)' to 'Escapable'
Requirement from conditional conformance of '(content: QUIC.ContentType, metadata: QUIC.Metadata)' to 'Copyable'
Requirement from conditional conformance of '(content: QUIC.ContentType, metadata: QUIC.Metadata)' to 'Escapable'
When I asked Cursor about what I was facing its response was as follows: "The connection.messages stream changed in the new Network APIs: it now yields typed (content, metadata) tuples. Iterating with for try await incoming in connection.messages asks the compiler to conform that tuple to Copyable/Escapable; for QUIC the tuple isn’t copyable, so you hit the conditional-conformance error."
I am curious if you've been able to use the new iOS 26 network APIs with QUIC?
Thank you, Captadoh
I’m not entirely sure how you got the error you’re getting. It’d help if you provided some more context to the code. However, it looks like you’re trying to use a QUIC connection (aka the tunnel) as a source of messages, whereas you should be trying to use a QUIC stream as that source.
Consider this snippet:
let endpoint: NWEndpoint = …
let tunnel = NetworkConnection(to: endpoint) {
QUIC(alpn: ["abc"])
}
let tlvStream = try await tunnel.openStream { quicStream in
TLV { quicStream }
}
for try await m in tlvStream.messages {
…
}
Lines 5 through 7 are key here. They open a QUIC stream over the tunnel and then wrap it in TLV so that you can receive messages, rather than bytes, from the stream.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"