On macOS, it's not uncommon to present windows as sheets that can be resized. By setting the NSWindow's various frame auto save properties, you can restore the size of the sheet the next time it is presented.
When presenting a Sheet from within SwiftUI using the .sheet view modifier, how can I preserve and restore the sheet's frame size?
The closest I've been able to come is to put the SwiftUI view into a custom NSHostingController and then into an NSViewControllerRepresentable and then override viewWillAppear and look for self.view.window, which is all little awkward.
Is there a more idiomatic way to achieve this in "pure" SwiftUI?
On macOS, it's not uncommon to present windows as sheets that can be resized. By setting the NSWindow's various frame auto save properties, you can restore the size of the sheet the next time it is presented.
Are you referring to Sheet or windows?
Currently SwiftUI sheets on macOS generally don't support resizing.
Is there a more idiomatic way to achieve this in "pure" SwiftUI?
Using NSHostingController is also perfectly acceptable. You might want to constrain up the hosting view to the window and that can allow content size changes to be reflected and resize the window.