Is there a way to give the app a minimum frame without setting the min frame of the contents?

Is there a way to give the app a minimum frame without setting the min frame of the contents?
typescript
Ethan Jackson

This example app when running on macOS 15.4 exhibits an odd animation behavior when opening and closing the sidebar.

All you need to do to fix it is remove the .frame(minWidth: 805, minHeight: 525) line but that means you cannot limit the size of the window.

I would like to have a minimum size for my app so defaultSize() does not work.

enum Page: String, Hashable { case settings = "Settings" case radio = "Radio" case connect = "Connect" var systemImageName: String { switch self { case .settings: return "gear" case .radio: return "radio" case .connect: return "dot.radiowaves.right" } } } struct ContentView: View { @State var pages = [Page.settings, Page.radio, Page.connect] var body: some View { NavigationSplitView { List(pages, id: \.self) { page in Label(page.rawValue.capitalized, systemImage: page.systemImageName) } } detail: { Text("Content") } } } @main struct NavigationTestsApp: App { var body: some Scene { Window("Navigation", id: "H") { Group { ContentView() // Without this line this animation bug does not happen .frame(minWidth: 805, minHeight: 525) } } } }

Video of the bug

Answer

You can put the frame modifier on the detail column's view. This does not cause the bug to occur.

NavigationSplitView { List(pages, id: \.self) { page in Label(page.rawValue.capitalized, systemImage: page.systemImageName) } } detail: { Text("Content") .frame(minWidth: 805, minHeight: 525) }

Related Articles