briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Add support for visionOS

Open freakboy3742 opened this issue 8 months ago • 4 comments

What is the problem or limitation you are having?

Now that the Python support libraries support visionOS, Briefcase should also support that platform.

Describe the solution you'd like

Add a platform backend to support tvOS. The implementation of this command will be almost identical to iOS, with some template and support apckage URL changes.

Describe alternatives you've considered

Additional context

The visionOS testbed project may also be useful as a point of reference.

freakboy3742 avatar Apr 24 '25 00:04 freakboy3742

Just wanted to say that this would be super helpful enhancement, and I'm happy that it's on the radar.

adamroszyk avatar Apr 28 '25 15:04 adamroszyk

To be completely clear - "On the radar" means "we're aware it exists", not "we're going to implement this any day now". I wouldn't expect this to get on the core team's roadmap for some time. The primary reason for this is the fact that visionOS (and watchOS) apps must be written in SwiftUI, and Rubicon can't currently invoke Swift APIs.

That said - as noted by the PR body, the Briefcase implementation will be almost the same as the implementation for iOS, so if someone is particularly motivated it shouldn't be overly difficult to refactor the iOS backend so that iOS-specific components can be replaced with visionOS-specific components.

freakboy3742 avatar Apr 28 '25 21:04 freakboy3742

@freakboy3742

We might be able to get away with UIKit alone: https://developer.apple.com/videos/play/wwdc2023/111215/ -- even though SwiftUI is the direction they're moving towards, UIKit is still a valid option; I don't know how we'll be limited by things such as the ability to include 3D objects, but given that 3D functionality is pretty hard to cross-platform abstract anyways, I personally am comfortable with Toga lacking any 3D-specific/immersion functionality.

That said I have actually gotten very simple apps running with our current template, along with Toga. There's some deprecated APIs we gotta deal with and standardize... but we gotta get packaging support in Briefcase first.

The main changes to the Xcode project are:

  • Add a visionOS target to the Xcode project
  • Change some references and folder names in the build scripts from iphoneos to xros, iphonesimulator to xrsimulator.
  • Use a visionOS support package

Therefore, this shouldn't be particularly too hard -- but we need to stay organized with code refactoring (cookiecutter etc).

johnzhou721 avatar Dec 07 '25 15:12 johnzhou721

After digging for 2 more hours -- it's not that viable. Things like ornaments which are things that float next to the window, which is very native and used a lot in visionOS that we might even use to implement toolbars, are only available to SwiftUI... originally I thought that UIWindow had an Ornaments property that'll accept UIOrnaments... and UIOrnaments are wrappers for SwiftUI Ornaments, so I thought we'd get away with writing a small library [in Swift interfaced to objc] called say "UIXRSwiftOrnaments", but then UIOrnaments, even though it's a UIKit-like class, is declared in SwiftUI and not available to Objective-C... [so you can't return them]

If anyone wants to work on visionOS related stuff for BeeWare: My suggestion is to wait a bit. There's some pieces that needs to be fixed in our iOS backend (like using the new SceneDelegate and tracking window size changes) and generally in Toga (like top-level app navigation, since OptionContainer limited to a small area will not work without hacks). There's also the libffi issue of Swift calling conventions and the need for a rubicon-swift. So simple things will work if one implements this ticket, but a small group of very hard new work remains to be one.

johnzhou721 avatar Dec 07 '25 22:12 johnzhou721