Home > Software engineering >  SwiftUI 3.0 for macOS: how to set .frame to open at maximum screen space
SwiftUI 3.0 for macOS: how to set .frame to open at maximum screen space

Time:11-10

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?

CodePudding user response:

you could try using:

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

works for me on macos 12.1 beta

  • Related