Controlling SwiftUI's Volume dimensions
This method you specified, sets a default size for a volumetric window.
func defaultSize(width: CGFloat,
height: CGFloat,
depth: CGFloat) -> some Scene
By default, each parameter (width, height, depth) is specified in points, which translates to 1 millimeter for volumetric scenes at standard system scale. The size of a volumetric scene is immutable after creation. If you want to follow the RealityKit scene-size-paradigm, use the initializer's fourth in
parameter that allows you to set the size in meters.
For me, the following approach does the trick (read this post to see the content of a volume in my visionOS app).
import SwiftUI
@main struct ParticlesApp : App {
var body: some Scene {
WindowGroup {
ContentView() // contains RealityKit scene
}
.windowStyle(.volumetric)
.defaultSize(width: 2.0, height: 2.0, depth: 2.0, in: .meters)
}
}
Controlling visionOS Window dimensions
visionOS SDK Beta 2 (Xcode 15 Beta 5)
In second beta of visionOS, there are some improvements on 2D window's resizability issue. You can control a size of window that is less or equal to 2m X 1m
(but not greater than this size).
@main struct SomeApp: App {
var body: some Scene {
WindowGroup {
ContentView() // contains 2D view
}
.defaultSize(width: 0.5, height: 0.5, depth: 0.0, in: .meters)
}
}
visionOS SDK Beta 1
.windowResizability(..)
modifier and all the other resizing methods are unavailable in visionOS Beta 1 (Xcode 15 beta 4 and lower).
You can find the identical question on the Developers Forums.
.windowStyle(.plain)
?) – Amberjack