Structured Concurrency with Network Framework Sample

I am trying to migrate an app to use Network framework for p2p connection. I came across this great article for migrating to Network framework however this doesnt use the new structured concurrency. This being introduced with iOS 26, there doesnt seem to be any sample code available on how to use the new classes. I am particularly interested in code samples showing how to add TLS with PSK encryption support and handling of switching between Wifi and peer to peer interface with the new structured concurrency supported classes. Are there any good resources I can refer on this other than the WWDC video?

Answered by DTS Engineer in 866929022
this doesnt use the new structured concurrency.

Right. It was written before the new API was release and I haven’t updated it yet because most folks who want to do this need to support iOS 18, where the new API isn’t available. Oh, and I haven’t had time |-:

I am particularly interested … TLS with PSK encryption support

AFAIK that’s not currently supported (r. 159170556)-:.

I’d appreciate you filing an enhancement request for that. While we have a bug about it already, it’s an internal bug, and bugs from third-party developers can help in situations like this.

Please post your bug number, just for the record.

switching between Wifi and peer to peer interface

I’m not sure I understand that. Please elaborate.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

this doesnt use the new structured concurrency.

Right. It was written before the new API was release and I haven’t updated it yet because most folks who want to do this need to support iOS 18, where the new API isn’t available. Oh, and I haven’t had time |-:

I am particularly interested … TLS with PSK encryption support

AFAIK that’s not currently supported (r. 159170556)-:.

I’d appreciate you filing an enhancement request for that. While we have a bug about it already, it’s an internal bug, and bugs from third-party developers can help in situations like this.

Please post your bug number, just for the record.

switching between Wifi and peer to peer interface

I’m not sure I understand that. Please elaborate.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

AFAIK that’s not currently supported (r. 159170556)

I would prefer to use an encrypted channel for communication. What options do I have with NetworkConnection in that case?

For the switching from Wifi and Peer to Peer part, I was curious if there was a guide on best practices for usage of onBetterPathUpdate and onViabilityUpdate for switching from an unstable interface to a better available interface. There doesnt seem to be much documentation on how these functions are supposed to be used.

Structured Concurrency with Network Framework Sample
 
 
Q