stackotter / swift-cross-ui

A cross-platform declarative UI framework, inspired by SwiftUI.
https://stackotter.github.io/swift-cross-ui/documentation/swiftcrossui/
MIT License
652 stars 36 forks source link

Give windows a sensible default size #90

Open stackotter opened 7 months ago

stackotter commented 7 months ago

At the moment windows default to the smallest possible size (under most backends). It'd be much nicer if they defaulted to some more sensible dimension such as 800x400 or something.

Any suggestions for default dimensions/aspect ratios?

ichordev commented 5 months ago

Would it be practical to have the window size be calculated based on the initially visible views?

stackotter commented 5 months ago

At the moment it kinda works like that (although that's just a result of not specifying a default window size, and letting each UI framework do whatever it wants). The main issue is that if you have a window that only contains Text("Hello, World!") then you get a tiny little window that is as small as it can possibly be (which in my eyes isn't a great default, although maybe other people think otherwise).

Using the 'natural size' of the window's initial contents in conjunction with some other factors such as a minimum default size etc could work well, although it's tricky to compute the size of an initial view in general (since it's backend specific and often UI frameworks adjust the sizes of views based on available space, making a feedback loop if you use content size to adjust the window size).

warmachinesocial commented 4 months ago

To be honest just have fixed window size the above could work

stackotter commented 4 months ago

Yeah, probably quite a sensible default at least