Reputation: 896
I seem to be missing something basic:
I have a window with a sidebar. The nested hierarchy is
ZStack {
NavigationView {
VStack {
//additional sub-views with my content/navigation view
}.frame(...)
}.frame(...)
}
When the window opens, everything is fine - my sidebar is the right size, the rest of the main window is fine. I just don't want someone to resize the window to the right (i.e. expanding it horizontally).
I've tried .frame(width: ..., height: ...)
, I've tried .frame(minWidth: ...)
, I've tried .fixedSize()
- it doesn't matter, I'm still able to expand the window horizontally.
What could I be missing or what should I look for?
Upvotes: 0
Views: 1815
Reputation: 914
I believe you need to set your maxWidth on the containing ZStack.
ZStack {
...
}.frame(maxWidth: 600)
Upvotes: 3