SharePlay Button

I learned Sharplay from the WWDC video. I understand the creation of seats, but I can't learn some of the following contents well, so I hope you can help me. The content is as follows: I have set up the seats.

struct TeamSelectionTemplate: SpatialTemplate {
    let elements: [any SpatialTemplateElement] = [
        .seat(position: .app.offsetBy(x: 0, z: 4)),
        .seat(position: .app.offsetBy(x: 1, z: 4)),
        .seat(position: .app.offsetBy(x: -1, z: 4)),
        .seat(position: .app.offsetBy(x: 2, z: 4)),
        .seat(position: .app.offsetBy(x: -2, z: 4)),
    ]
}

It was mentioned in one of my previous posts: "I hope you can give me a SharePlay Button. After pressing it, it will assign all users in Facetime to a seat with elements quantified in TeamSe lectionTemplate.", and someone replied to me and asked me to try systemCoordinator.configuration.spatialTemplatePreference = .custom (TeamSelectionTemplate()), however, Xcode error Cannot find 'systemCoordinator' in scope How to solve it? Thank you!

Answered by Vision Pro Engineer in 792204022

Hey @lijiaxu,

Please take a look at the Customizing spatial Persona templates sample code. This provides a great example for spatial templates. Specifically the SessionController.swift file is where the systemCoordinator is retrieved from the GroupSession and used.

The usage of this is also covered in the SystemCoordinator docs, specifically this section:

After you receive a GroupSession object for an activity, retrieve the system coordinator from the session’s systemCoordinator property. When you first retrieve the object, update its configuration property to tell the system how you want to arrange participants in the scene.

Hope that helps!

Michael

Accepted Answer

Hey @lijiaxu,

Please take a look at the Customizing spatial Persona templates sample code. This provides a great example for spatial templates. Specifically the SessionController.swift file is where the systemCoordinator is retrieved from the GroupSession and used.

The usage of this is also covered in the SystemCoordinator docs, specifically this section:

After you receive a GroupSession object for an activity, retrieve the system coordinator from the session’s systemCoordinator property. When you first retrieve the object, update its configuration property to tell the system how you want to arrange participants in the scene.

Hope that helps!

Michael

SharePlay Button
 
 
Q