SharePlay (GroupActivities) vs MultipeerConnectivityService in visionOS Apps

SharePlay & Group Activities

I was able to implement entity position synchronisation via SharePlay (Group Activities) in my visionOS app by following the tutorials on SharePlay in the "Draw Together" app from these WWDC sessions:

  1. https://developer.apple.com/wwdc21/10187
  2. https://developer.apple.com/wwdc22/10140

While referencing the sample code at: https://developer.apple.com/documentation/groupactivities/drawing_content_in_a_group_session

MultipeerConnectivityService

However, it seems that RealityKit has something called MultipeerConnectivityService for Entity position synchronisation and it seems to be a pretty robust solution that will sync not only positions but also other things like Codable components. 🤔

See docs at: https://developer.apple.com/documentation/realitykit/multipeerconnectivityservice

Call for help

Can anyone share example code that implements MultipeerConnectivityService ? I wonder if this is the recommended approach by Apple?

I must say, writing custom messages to sync the Entity positions via Group Activities was very hard 😅 I was just thinking what I should do for all the entity components now...

Hello,

GroupActivities is geared towards connections with remote devices (potentially very far away), whereas MultipeerConnectivityService is for connections with nearby devices.

Can you explain a little bit more about your use-case? Then I might be able to offer a recommendation!

SharePlay (GroupActivities) vs MultipeerConnectivityService in visionOS Apps
 
 
Q