Network Framework or MultipeerConnectivity?

Hi, I'm wondering if I should choose between Network Framework or MultipeerConnectivity for my peer-to-peer needs. It'll only be between two devices, and won't be with huge amounts of data (some text and an image).

Since I'm using SwiftUI, I won't be needing to support older iOS versions.

I like the idea of Network Framework, because:
  1. It's newer, so it has a much nicer API which doesn't feel like a thin layer over Objective-C.

  2. It lets me define my own transport protocol, so I have more fine-grain control over how I send, receive, and parse my messages. Meanwhile, MultipeerConnectivity seems to use a weird combination of TCP and UDP which is abstracted away from us.

What do you think?

Use Network framework.

Multipeer Connectivity has its place but, IMO, it’s a very limited place. It’s best to use that framework when your requirements match up with its design, and specifically its multipeer nature. In Multipeer Connectivity each of the devices acts as a peer; the networking is fully symmetric. That’s cool, and its occasionally useful, but in most cases some asymmetry is actually useful.

Network framework supports the traditional networking asymmetry, one server with 0 or more clients, and my experience is that this is a much simpler model to think about.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Network Framework or MultipeerConnectivity?
 
 
Q