<!--
{
  "availability" : [
    "macOS: 27.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpatialPreview",
  "identifier" : "/documentation/SpatialPreview/DocumentPreviewSession/start(endpoint:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Spatial Preview"
    ],
    "preciseIdentifier" : "s:14SpatialPreview08DocumentB7SessionC5start8endpointyAA0aB8EndpointV_tYaKF"
  },
  "title" : "start(endpoint:)"
}
-->

# start(endpoint:)

Connects to the specified endpoint and prepares the session to send document updates.

```
final nonisolated(nonsending) func start(endpoint: SpatialPreviewEndpoint) async throws
```

## Parameters

`endpoint`

The destination endpoint representing the device to connect to.

## Discussion

Call this method once before sending document content via [`updateContents(data:)`](/documentation/SpatialPreview/DocumentPreviewSession/updateContents(data:)) or
[`updateContents(url:)`](/documentation/SpatialPreview/DocumentPreviewSession/updateContents(url:)). The method establishes connection and transitions the session’s `state` to
[`SpatialPreviewSessionState.connected`](/documentation/SpatialPreview/SpatialPreviewSessionState/connected).

> Throws: ``doc://com.apple.SpatialPreview/documentation/SpatialPreview/SpatialPreviewSessionError`` if the connection cannot be established or the
> session has already been invalidated.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)