---
title: visionOS on Swift
slug: best-practices/how-to/swift/visionos-beta-guide
docTags: 
createdAt: 2024-06-14T17:15:47.470Z
---

This article provides an overview of the Ditto SDK for visionOS, instructions on how to get started, as well as steps outlining example integration with our demo chat app, *DittoChat*:

- [Ditto SDK for visionOS Beta](docId:9eYfPNj_xG4j-R85evDAh)
- [Getting Started](./#getting-started)
- [Exploring with a Demo App](./#exploring-with-a-demo-app)

In beta as an early preview, our Swift SDK now offers support for the visionOS target — enabling you to sync Apple Vision Pro devices on- or offline across devices including iPhone, Android, and other Apple Vision Pros.&#x20;

For more information about the visionOS platform, see the official Apple documentation for [visionOS](https://developer.apple.com/visionos/).&#x20;

# Getting Started

To get started with the Ditto SDK for visionOS on Swift:

::::WorkflowBlock
:::WorkflowBlockItem
Confirm you have the minimum requirements:

- Xcode version 15.2 or later
- visionOS platform version 1.0, 1.1, or 1.2
:::

:::WorkflowBlockItem
Explore with either a prebuilt app, your existing Ditto-backed app, or a brand-new app:

- To use a prebuilt app, clone, install dependencies, build, and run the DittoChat demo app upgraded to visionOS beta release version 4.8.0. ([Exploring with a Demo App](./#exploring-with-a-demo-app))

- To enable Apple Vision Pro compatibility for an existing app already integrated with Ditto, add version 4.8.0 visionOS beta Ditto Swift Package dependencies to your project. &#x20;

  For dependencies, go to the `getditto/DittoSwiftPackage` repo in GitHub:
  [`DittoSwiftPackage/releases/tag/4.8.0-visionos-beta.1
  `](https://github.com/getditto/DittoSwiftPackage/releases/tag/4.8.0-visionos-beta.1)

- To build a new app, install the Ditto SDK for Swift with the **4.8.0-visionos-beta.1** dependency rule. (See  [Swift Install Guide](docId\:FonMHjPHDgLwDeZcHoonq))&#x20;
:::

:::WorkflowBlockItem
Once installed and your environment configured for visionOS, the Ditto Swift SDK automatically enables Apple Vision Pro compatibility for your app:

::embed[]{url="https://www.youtube.com/watch?v=8Kf8bSGaf14"}
:::
::::

## Exploring with a Demo App

If you prefer learning by doing, run the upgraded DemoChat app with an Apple Vision Pro simulator:

:::::WorkflowBlock
:::WorkflowBlockItem
Ensure you have the visionOS version 1.0, 1.1, or 1.2 installed in Xcode.
:::

::::WorkflowBlockItem
Clone the [`visionos-beta`](https://github.com/getditto/demoapp-chat/tree/visionos-beta) branch of the `getditto/demoapp-chat` GitHub repo:

:::CodeblockTabs
bash

```none
git clone -b visionos-beta https://github.com/getditto/demoapp-chat.git
```
:::
::::

::::WorkflowBlockItem
Navigate to the `/iOS` directory:

:::CodeblockTabs
bash

```none
cd demoapp-chat/iOS 
```
:::
::::

::::WorkflowBlockItem
Set up the environment variables:

:::CodeblockTabs
bash

```none
cp .env.template .env
```
:::
::::

::::WorkflowBlockItem
Open the `.env` file located in the `/iOS` directory, and then enter your sync credentials for peer-to-peer authentication.

Add your sync credentials (app ID and online playground token) available from the [portal](https://portal.ditto.live/?_gl=1*1cej9hc*_ga*MjAxODM3ODUyMi4xNzE4NjUzNzYz*_ga_D8PMW3CCL2*MTcxODc1NDE1OS45LjAuMTcxODc1NDE1OS42MC4wLjA.). (See [Sync Credentials](docId:1zqHo9HLq-mO6v1AQnAzl))

:::BlockQuote
DITTO\_APP\_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DITTO\_PLAYGROUND\_TOKEN=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
:::
::::

:::WorkflowBlockItem
From Xcode, using the Apple Vision Pro simulator, build the app and sync.&#x20;
:::
:::::

:::hint{type="info"}
For the minor changes in progress for DittoChat enabled with visionOS compatibility, see [visionOS Beta Platform Support #124](https://github.com/getditto/demoapp-chat/pull/124) pull request in GitHub.
:::

