I'm currently working on the networking side of my SwiftUI app, and my question is, how would I go about making both devices both NWBrowsers and NWListeners at the same time? The first device to find an NWListener (through Bluetooth proximity and NWBrowser) would tell the other to cancel their NWBrowser, effectively becoming the server while the first one stays the client. Then, when the data transfer from the server to the client is done, they would switch places, so that the first phone can transfer their data to the second.
I don't have much experience in Networking, and the lack of explanative documentation for the Network Framework means the learning curve is very steep. Do I even need to do the server-client switching, or will NWConnection take care of that? Maybe a custom framing protocol, like what Apple showed in their WWDC presentation? I would be grateful for a few pointers or what direction I should take.
P.S: I know MultipeerConnectivity fits my needs and abstracts away many of the technicalities in networking, but it's unsupported (compared to Network) and doesn't offer the level of customisation that I'll need in the future (especially for Bluetooth proximity, which is how, when an NWListener gets very close, NWBrowser knows it must connect to it).