Mane Manero
Mane Manero

Reputation: 3778

SwiftUI 3.0 for macOS: how to set .frame to open at maximum screen space

Goal: set .frame to open at maximum screen space

What I did:

ContentView()
.frame(minWidth: 700, idealWidth: .infinity, maxWidth: .infinity, minHeight: 500, idealHeight: .infinity, maxHeight: .infinity)

Problem: the frame still opens at the minHeight and minWidth.

Question: How can I set frame, so it will always open according to the full user device screen?

Upvotes: 0

Views: 199

Answers (1)

you could try using:

 .frame(minWidth: NSScreen.main?.frame.width, minHeight: NSScreen.main?.frame.height)

works for me on macos 12.1 beta

Upvotes: 1

Related Questions