Skip to content

Support visionOS #855

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Support visionOS #855

wants to merge 2 commits into from

Conversation

mihai8804858
Copy link
Contributor

This PR adds support for visionOS by adding a bunch of os(visionOS) checks and #available(visionOS 1.0, *).

ViewImageConfig for Vision Pro was added:

public static let visionPro = ViewImageConfig(
  safeArea: .zero,
  size: .init(width: 2700, height: 1360),
  traits: .init()
)

And UITraitCollection for Vision Pro was added:

public static let visionPro = UITraitCollection(
  traitsFrom: [
    .init(userInterfaceIdiom: .vision),
    .init(horizontalSizeClass: .regular),
    .init(verticalSizeClass: .regular),
    .init(displayScale: 2.0),
    .init(userInterfaceStyle: .dark),
    .init(layoutDirection: .leftToRight),
    .init(forceTouchCapability: .unavailable),
    .init(preferredContentSizeCategory: .large),
    .init(accessibilityContrast: .normal),
    .init(userInterfaceLevel: .base),
 ]
)

To support visionOS I had to update Xcode version to 15.3, and update test devices to iPhone 15 Pro Max (17.4) and Apple TV 4K (17.4).

Copy link

@janviaroraa janviaroraa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts need to be resolved.

@mihai8804858
Copy link
Contributor Author

Conflicts need to be resolved.

Done.

@stephencelis
Copy link
Member

@mihai8804858 Thanks for contributing and sorry for the delayed response! We're definitely open to supporting visionOS compilation, but can we please make a couple changes before merging?

  1. Let's not worry about the visionOS tests for now. It's a lot added to the repo and affects downstream clones.
  2. Can we focus only on the #if compiler directives? The ViewImageConfig stuff is a little tough to vet and keep up to date.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants