How to resize VisionOS window proportionally?

Apps in VisionOS can be resized by dragging a bottom right corner. But the resize mechanism is freeform (it can be resized at any width and height). How to resize the window to keep aspect ratio like it's in the native Calendar VisionOS app using UIKit?

Really interested in that too. Anyone came up with a solution?

You can access the UIWindowScene call requestGeometryUpdate on it, like so:

(on some view)
.onAppear() {
    guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else {
        return
     }
     let geometryRequest = UIWindowScene.GeometryPreferences.Vision(
          // addition parameters: size, max size ...
          resizingRestrictions: .uniform // maintain aspect ratio when resizing
     )
                    
     windowScene.requestGeometryUpdate(geometryRequest)
}

Worked perfectly @avhwl, thanks so much!

How to resize VisionOS window proportionally?
 
 
Q