Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Vision OS Support #167

Open
stephenfung98 opened this issue Jan 14, 2024 · 3 comments
Open

Vision OS Support #167

stephenfung98 opened this issue Jan 14, 2024 · 3 comments

Comments

@stephenfung98
Copy link

Hi Exyte,

I'm getting the following error in Source/Utils.swift

Missing return in getter expected to return 'CGSize'

on static var screenSize: CGSize.

@f3dm76
Copy link
Collaborator

f3dm76 commented Jan 14, 2024

Hey @stephenfung98, unfortunately we do not support visionOS for now, you are most welcome to commit a PR adding this functionality, have a wonderful day!

@stephenfung98
Copy link
Author

Thank you for your response.

I initially believed that the package supported visionOS based on the information available at https://swiftpackageindex.com/exyte/PopupView/builds.

I will explore options to add visionOS compatibility to this package.

@ckempke
Copy link

ckempke commented Feb 11, 2024

I'm not familiar enough with Swift Package Manager to let it give me modifiable files from a github dependency, so I just grabbed source. But I was able to get this working at least enough to do simple toasts and popups on visionOS by merely extending the CGSize extension in Utils.swift:

extension CGSize {

    static var screenSize: CGSize {
#if os(iOS) || os(tvOS)
        return UIScreen.main.bounds.size
#elseif os(watchOS)
        return WKInterfaceDevice.current().screenBounds.size
#elseif os(macOS)
        return NSScreen.main?.frame.size ?? .zero
#else
        // visionOS or something else.  "Full Screen" doesn't really
        // mean much here, so return an arbitrary, reasonable size for a "screen"
        return CGSize(width: 1000, height: 1000)
#endif
    }
}

As the comment implies "Full Screen" is a little undefined on an infinite canvas, but the things you would expect to work do work.

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

No branches or pull requests

3 participants