Member-only story
Migrating my SwiftUI App to VisionOS in 2 Hours
How I migrated my SwiftUI app CrossCraft to support visionOS for the Day 1 Release of the Apple Vision Pro. It took effectively about 2 hours in total, this article summarizes my key learnings along the way.
Just a few months ago, I released CrossCraft: Custom Crosswords, an app written entirely in SwiftUI and available on iOS, iPadOS, and macOS. For the launch of the Vision Pro, I set myself a challenge to migrate it to the new visionOS platform — but I started the migration just 3 days before launch day!
So the question was if I would be able to pull it off in this short amount of time. But luckily it turned out to be easy enough, so my app was ready on Day 1! 👇
The following are all of my learnings that could help you migrate your apps, too!
3rd-Party Frameworks
After adding the “Apple Vision” destination to my project, the first thing I did was selecting the “Apple Vision Pro” simulator and starting a build.
As I was expecting, the build failed. Because not all frameworks support the visionOS platform yet. But adding basic support was easy. Here are the 4 steps:
- Fork the dependency, remove it from your project & add your fork with the
main
branch instead. - Open the
Package.swift
file in the fork, bump the Swift tools version at the top of the file to5.9
and add.visionOS(.v1)
to the supportedplatforms
array. - Search for any mentions of
#if os(iOS)
and change them to#if os(iOS) || os(visionOS)
to avoid building the macOS path, preferring the iOS path.