How to disable sidebar minimization in macOS? In app like App Store, Music, Reminders, Mail, Messages this is disabled. In an app like Feedback Assistant, there is a critical error - after minimizing it, you cannot open the sidebar unless you clear ~/Library/Containers/Feedback Assistant.
At the same time, if you use NavigationView there will be no button to close/open the sidebar, while the menu itself can be minimized. Why Sidebar called Navigation*View?
I've seen other threads where this is done by adding additional dependencies, using swiftui-introspect, but I'm not happy with this method due to the fact that it's a dependency. Is SwiftUI so incomplete that it doesn't have the usual functions for working with UI elements? And why do you need to create such a huge number of abstractions AppKit, UIKit, SwiftUI?
It seems that the main thing for Apple is aesthetic completeness, while functional completeness is absent at all or you need to understand the nested concept and only then you will realize how to use some Framework features, while the documentation does not reflect it at all. This whole declarative style smells like bullshit, because even half of the examples at WWDC don't work properly, and the documentation is written "through the ass". #apple
To prevent the sidebar from being toggled, you can hide the toggle button:
Unfortunately, hiding the toggle does not prevent the sidebar from being closed by dragging its edge to the side. And as you pointed out, once the sidebar has been hidden, it can be difficult to get it back. Even if the app is restarted, it seems to remember that the sidebar was hidden and leaves it hidden.
I couldn't find a way to prevent the sidebar from being hidden by drag. However, what you can do is associate the column visibility with a
NavigationSplitViewVisibilitybinding. Then you can use anonChangehandler to detect if the sidebar has been hidden and force it to re-open again. I found that this needs to be performed asynchronously with a short wait (1 sec seems to suffice).