UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Set window size of application

Forums > SwiftUI

Is there a simple way to define a defualt window size when the application opens from the first time? I have a reletivley small window about 450x165 but everytime I launch the app for the first time or launch a new window it opens a massive 900x450 window and I just cannot understand why its doing it. I know I can use .frame(width:,height:) but that makes my window not resizable and more importantly does not let me put it into split screen mode. I have tried .frame(idealWidth:,idealHeight:) but that does nothing. I tried by using NSApplicationDelegate applicationDidFinishLaunching but the issue there is that I have a State variable in my @main App struct to which one of my views binds to. Please help me out here I would never think that setting a default window frame would be this hard.

4      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.