I have a macOS app window where I present a sheet that lets a user login to a server. When the user selects the cancel login option, I would like the sheet to be dismissed and the hosting window closed. I know how to dismiss the sheet. How do I close the window?
If you have defined
then call
More details here:
https://stackoverflow.com/questions/58494700/swiftui-on-mac-close-window-and-open-another-one
To dismiss the sheet, 2 options:
https ://www.hackingwithswift .com/quick-start/swiftui/how-to-make-a-view-dismiss-itself
Code Block let myWindow:NSWindow?
then call
Code Block self.myWindow?.close()
More details here:
https://stackoverflow.com/questions/58494700/swiftui-on-mac-close-window-and-open-another-one
To dismiss the sheet, 2 options:
environment var
binding to hold status of sheet
https ://www.hackingwithswift .com/quick-start/swiftui/how-to-make-a-view-dismiss-itself