status
The connection status of the session.
Declaration
@MainActor final var status: FoveatedStreamingSession.Status { get }Discussion
Observe this property to monitor the session’s connection status, as well as obtain disconnection reasons. The default value is FoveatedStreamingSession.Status.initialized.
For example, you can display a view that’s only visible when the session is fully connected:
var body: some View {
if session.status == .connected {
ConnectedView()
} else {
NotConnectedView()
}
}You can obtain the disconnect reason whenever the session disconnects as follows:
.onChange(of: session.status) {
if case .disconnected(let disconnectReason) = session.status {
print(disconnectReason.errorDescription)
}
}