why is visionOS2 not respsecting my volumetric window's default size?

Generated on 8/8/2024

1 search

It seems that your volumetric window's default size in visionOS 2 is not being respected due to the way volumes inherit their sizes from their content. By default, volumes in SwiftUI inherit their minimum and maximum sizes from the size of their content, as explained in the session Dive deep into volumes and immersive spaces. This behavior is provided by the window resizability modifier, which means the volume's minimum and maximum sizes are determined by the size of its views.

To address this, you can specify minimum and maximum values for the frame of your volume's content. This will allow the volume to resize accordingly. If you want the volume to have a fixed size, you should set both the minimum and maximum sizes to the same value.

Additionally, the session Work with windows in SwiftUI discusses how to set limits on how a window can be resized by specifying minimum and maximum sizes for the content it contains. This ensures that the window size matches the size of the content and can be resized within reasonable limits.

For more detailed information, you can refer to the chapters on "Volumes: Size" and "Sizing" in the respective sessions: