Contents

defaultWorldScaling(_:)

Specify the world scaling behavior for the window.

Declaration

nonisolated func defaultWorldScaling(_ scaling: WorldScalingBehavior) -> some Scene

Discussion

By default, regular windows increase their physical size as they move further away, ensuring they remain at the same angular size. This preserves legibility and ease of use for text and controls. Volumes render with a fixed physical size, because they are most commonly used for 3D content which is meant to behave with greater physical accuracy.

This modifier overrides the physical scaling behavior for volumes, so they scale like windows while still maintaining other volumetric behaviors.

This modifier has no effect on immersive spaces or windows without a window style of volumetric.

@main
struct SampleApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        .windowStyle(.volumetric)
        .defaultWorldScaling(.dynamic)
    }
}

For further information, see Spatial layout in the Human Interface Guidelines.

See Also

Interacting with volumes