The MCBrowserViewController class presents nearby devices to the user and enables the user to invite nearby devices to a session. To use this class in iOS or tvOS, call methods from the underlying UIViewController class (prepare(for:sender:) and performSegue(withIdentifier:sender:) for storyboards or present(_:animated:completion:) and dismiss(animated:completion:) for nib-based views) to present and dismiss the view controller. In macOS, use the comparable NSViewController methods presentAsSheet(_:) and dismiss(_:) instead.


iOS, Mac Catalyst, tvOS
class MCBrowserViewController : UIViewController
class MCBrowserViewController : NSViewController


Initializing a Browser View Controller

init(serviceType: String, session: MCSession)

Initializes a browser view controller using the provided service type and session.

init(browser: MCNearbyServiceBrowser, session: MCSession)

Initializes a browser view controller with the provided browser and session.

var delegate: MCBrowserViewControllerDelegate?

The delegate object that handles browser-view-controller-related events.

var browser: MCNearbyServiceBrowser?

The browser object that is used for discovering peers.

var session: MCSession

The multipeer session to which the invited peers are connected.

Getting and Setting the Maximum and Minimum Number of Peers

var maximumNumberOfPeers: Int

The maximum number of peers allowed in a session, including the local peer.

var minimumNumberOfPeers: Int

The minimum number of peers that need to be in a session, including the local peer.