Searches (by service type) for services offered by nearby devices using infrastructure Wi-Fi, peer-to-peer Wi-Fi, and Bluetooth (in iOS) or Ethernet (in macOS and tvOS), and provides the ability to easily invite those devices to a Multipeer Connectivity session (MCSession).


class MCNearbyServiceBrowser : NSObject


Initializing the Browser

init(peer: MCPeerID, serviceType: String)

Initializes the nearby service browser object.

var delegate: MCNearbyServiceBrowserDelegate?

The delegate object that handles browser-related events.

var myPeerID: MCPeerID

The local peer ID for this instance.

var serviceType: String

The service type to browse for.

Browsing for Peers

func startBrowsingForPeers()

Starts browsing for peers.

func stopBrowsingForPeers()

Stops browsing for peers.

Inviting Peers

func invitePeer(MCPeerID, to: MCSession, withContext: Data?, timeout: TimeInterval)

Invites a discovered peer to join a Multipeer Connectivity session.


Inherits From

Conforms To