Thread
I'm happy that I made the switch to AppKit for the window management. Even though it's not as fun to work with, it's just so much more reliable than SwiftUI if you want to do something more complex.
Frederik Handberg
I tried using `UserDefaults` to save the IDs of open windows, so that when terminating the app and then re-launching, the app would open the same windows again.
But apparently, this is not as easy as I thought - at least not when using #SwiftUI.
I'm moving to an #AppKit approach instead to handle my window management... #dev
View quoted note →
Replies (2)
I now have a working solution that remembers exactly which windows were open before terminating the app.
This makes sure that when launching the app, the same windows will be opened again.
**Only seem to be one issue left to fix:** The `LaunchView` window should not appear on startup if we already have at least one open window with a Space.
It certainly took longer than I expected to get my window management working, and it’s not even fully working yet, as I still need to stop the `LaunchView` from always appearing on startup. I didn’t get around to working on that today, because I’ve been focused on learning how to use the `NSViewController` (AppKit) instead of `WindowGroup` (SwiftUI) as I used before.