Demonstrates an issue where the toolbar of a NavigationSplitView looks scrambled when SwiftUI does a window restoration.
To reproduce:
- Make sure window restoration is tuned on in system settings ("Close windows when quitting an application" needs to be off)
- Open app
- click "Open Window A" button
- click "Open Window B" button
- See two windows that look correct
- Close app (CMD+Q)
- Open app again: one window toolbar is scrambled (divider is at the wrong position).
This is 100% caused by setting an explicit ID on the view:
ContentView()
.id(value) // <-- issue
But: Without an explicit ID, @StateObject is incorrectly initiated multiple times.