I've been working on several visionOS
demos without concerning about multiplatform compatibility, now than I'm ready to develop a full app I've found out that creating a multiplatform project (at least iOS
and visionOS
) isn't as straight forward as I expected, now not even sure if it's possible.
Choosing Multiplatform
in the new project wizard only allows running on iOS
and macOS
, and choosing visionOS
only allows (obviously) running on the visor. I understand that Apple Vision has unique capabilities, but for an app that it's 90% a regular SwiftUI windows navigable, I'd like to think that I don't need to mantain to parallel projects.
So is it possible to have one single project executable in all devices? (even if there're some specific immersive features available only for visionOS)
Yes. You can even have your project compatible to macOS. When you setup your Xcode project, you must add the Apple Vision
and Mac
app Designed for iPad
.
The Apple's idea is to create an iPad version of your application, which is compatible for those two devices. You still have to use conditional statements to use different background materials for your visionOS app or other setup, but it is easy to do so with SwiftUI.
Xcode Version 15.2
To do so, within your Xcode project, go to: Your project Name -> Your Project Target -> General -> Supported Destinations.
If you want to have the full Apple Vision app with their material background, select Apple Vision
as the destination in place of the one Designed for iPad
.