Contents

RemoteDeviceIdentifier

An opaque type that identifies a remote device displaying scene content in a Remoteimmersivespace.

Declaration

struct RemoteDeviceIdentifier

Overview

Access this from the remoteDeviceIdentifier environment property in a remote scene to get the identifier for that scene’s device.

When accessed in a context that is being presented on the local device, this value will be nil.

This identifier can also be used to initialize an ARKitSession associated with the remote device.

struct SolarSystem: CompositorContent {
    @Environment(\.remoteDeviceIdentifier) private var deviceID

    var body: some CompositorContent {
        RemoteImmersiveSpace {
            CompositorLayer { layerRenderer in
                // Create an ARSession for the device
                let arSession = ARKitSession(deviceID)

                // Set up and run the Metal render loop.
                let renderThread = Thread {
                    let engine = solar_engine_create(
                        layerRenderer, arSession)
                    solar_engine_render_loop(engine)
                }
                renderThread.name = "Render Thread"
                renderThread.start()
            }
        }
    }
}

Topics

Instance Properties

See Also

Handling remote immersive spaces