How-To Tutorials
Swift

visionOS on Swift

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:

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.

For more information about the visionOS platform, see the official Apple documentation for visionOS.

Getting Started

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

1

Confirm you have the minimum requirements:

  • Xcode version 15.2 or later
  • visionOS platform version 1.0, 1.1, or 1.2
2

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)
  • 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. For dependencies, go to the getditto/DittoSwiftPackage repo in GitHub: 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)
3

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



Exploring with a Demo App

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

1

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

2

Clone the visionos-beta branch of the getditto/demoapp-chat GitHub repo:

bash

3

Navigate to the /iOS directory:

bash

4

Set up the environment variables:

bash

5

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. (See Sync Credentials)

DITTO_APP_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx DITTO_PLAYGROUND_TOKEN=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
6

From Xcode, using the Apple Vision Pro simulator, build the app and sync.

For the minor changes in progress for DittoChat enabled with visionOS compatibility, see visionOS Beta Platform Support #124 pull request in GitHub.