Contents

MultipeerConnectivityService

A service that provides scene synchronization among all peers in a multipeer connectivity session.

Declaration

class MultipeerConnectivityService

Overview

RealityKit uses this class to automatically sync scenes with other connected devices running the same app. It leverages the Multipeer Connectivity framework to automatically keep the scenes of all connected devices synchronized. To sync a RealityKit scene, create a MultipeerConnectivityService object initialized with an MCSession and assign it to your scene’s synchronizationService property.

let peerID = MCPeerID(displayName: UIDevice.current.name)
let session = MCSession(peer: peerID, securityIdentity: nil, encryptionPreference: .required)
arView.scene.synchronizationService = try?
MultipeerConnectivityService(session: self.session)

For more information on browsing for, and connecting to, other devices, see Multipeer Connectivity.

Topics

Creating a connectivity service

Getting the session

Managing ownership

Finding an entity

Pausing and resuming

Configuring the session

See Also

Multipeer synchronization