Multipeer Connectivity in iOS
In this course, you'll learn how to use Multipeer Connectivity: Apple's framework for transferring data between devices with no external network. By Jessy Catterwaul.
4 (1) · 1 Review
Who is this for?
If you need a way to communicate wirelessly with Apple devices in close proximity to each other, in a blazing fast way, and you're quite comfortable with Swift, this course is likely a good match for you. SwiftUI and Combine knowledge will be helpful: they're both used in this course, but are not essential for employing Multipeer Connectivity.
- Local Networking
Set up Info.plist
The first step to adding Multipeer Connectivity to any app is to ask for permission and tell users why it will use a local network. You'll use Info.plist for this.
Advertise a Device
In order to advertise your device to others, you'll need to use a reference to a Multipeer Connectivity Session object.
Once your device is advertising that it’s available, you'll need to employ MCNearbyServiceAdvertiserDelegate to handle requests to connect to other devices.
When you have devices advertised through Multipeer Connectivity, the next step is to discover them. For that, you can use an MCNearbyServiceBrowser object.
With an MCSession on one device, you can send data. And on another, an MCSessionDelegate will receive it.
Multipeer Connectivity provides a standard UI that abstracts what can be achieved with MCNearbyServiceBrowser: MCBrowserViewController.