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:
Platforms State of the Union
Discover the newest advancements on Apple platforms.
Work with windows in SwiftUI
Learn how to create great single and multi-window apps in visionOS, macOS, and iPadOS. Discover tools that let you programmatically open and close windows, adjust position and size, and even replace one window with another. We’ll also explore design principles for windows that help people use your app within their workflows.
Dive deep into volumes and immersive spaces
Discover powerful new ways to customize volumes and immersive spaces in visionOS. Learn to fine-tune how volumes resize and respond to people moving around them. Make volumes and immersive spaces interact through the power of coordinate conversions. Find out how to make your app react when people adjust immersion with the Digital Crown, and use a surrounding effect to dynamically customize the passthrough tint in your immersive space experience.