'Restoring macOS window size after close using SwiftUI WindowsGroup
By default, on a macOS app using SwiftUI the window size is not restored after the window is closed.
Is there a way to keep whatever size & position the user gave before closing the app. Essentially I'd like close & open to behave in the same way to when the user quits & opens the app?
Is there something that should be added here?
import SwiftUI
@main
struct testApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|