Post

Replies

Boosts

Views

Activity

Reply to Scene.windowIdealSize(.fitToContent) seems not working
I did't fully read the documentation and misunderstood this API. Scene.windowIdealSize(_:) is for zooming in macOS. (The command "Window" > "Zoom" can trigger it.) This also explains why there exists WindowIdealSize.maximum, I think. For my needs, I used Scene.defaultSize and people would see my designed window size on first-time window presentation. WindowGroup { Color.accentColor.opacity(1/4) .frame(minWidth: 500, minHeight: 500) .frame(idealWidth: 800, idealHeight: 800) } // For window zooming (a macOS feature), // which can be accessed via double-clicking the window title bar (see Settings). .windowIdealSize(.fitToContent) // For window size on first presentation .defaultSize(width: 640, height: 640) In this example, people will see 640640 window for the first time. Also, when people zoom this window, it expands to 800800, not as large as it can.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25