PopupView
PopupView copied to clipboard
Vision OS Support
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
.
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!
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.
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.
Hey @stephenfung98, info at Swift Package Index is auto generated for all the platforms, please refer to package.swift file to see supported platforms and versions. Anyway, VisionOS compilation was fixed here https://github.com/exyte/PopupView/issues/187, please check it out.