Background
I am working on a MacOS application in SwiftUI in Xcode 12.4 on Catalina. Right now my app has a landing page with tiles and each tile contains a feature that is displayed using sheets.
ForEach(MenuItem.allCases) { menuItem in
Button(action: {
detailView = menuItem
}) {
Tile(labelText: menuItem.menuText, icon: menuItem.menuIcon)
.sheet(item: $detailView) { item in
FeatureView(dismissFeatureView: { self.detailView = nil }, menuItem: item)
.environmentObject(container)
.background(Color("backgroundMain"))
}
}
}
The window has a minimum width and height, but can be expanded given it has no max height or width. I'm looking for a way to make the sheet take up the entire screen. On iOS you can use .fullScreenCover() but this isn't available on MacOS. So now, when I make the screen large and click on a tile the sheet view doesn't take up the entire space.
Additionally, the user is able to resize the sheet beyond the size of the window, as seen here.
The Question
How can I get the sheet views to match the size of the window (which does not have a max width or height) so the user can still resize the window, but ensure that the sheet always takes up the entirety of the window.