GO FURTHER, FASTER: Try the Swift Career Accelerator today! >>

Is there a way to open a document in a visionOS app?

Forums > visionOS

I have a document-based app that I wrote for macOS. I'd like to open the document in an app on visionOS, but I don't see any way to build a document-based app for visionOS at the moment. Are there any workarounds to be able to open a document in an app in visionOS?

   

Yes, seems fine. I generally open and read a data file for the visionOS app that I'm working on.
I don't have experience with document-based apps, but I just tried, using the latest beta software, to create a new project, iOS, Document App, and then under the General settings for Destination, I added sipport for Apple Vision with the SDK as visionOS (it already had Apple Vision (Designed for iPad) with the SDK as iOS). The document then ran fine in the simulator as well as the actual VisionPro. It seems to work fine with either the virtual keyboard as well as the bluetooth connected keyboard and trackpad.

   

Hi, thanks for the reply!

I took a similar approach: I added a visionOS target for my existing document-based macOS app, added the file with the FileDocument struct as a target for my visionOS target, and added the DocumentGroup code to my main SwiftUI file, and it works as expected!

I guess I should mention that I accomplished this in macOS Sonoma 14.5 and Xcode 15.4.

   

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until February 9th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.