79195282

Date: 2024-11-16 14:00:42
Score: 3
Natty:
Report link

I found out that in Xcode 16+ using canCollapseFromWindowResize with canCollapse did the trick and you cannot hide the sidebar anymore by dragging it on macOS.

        NavigationSplitView {
            Text("sidebar")
            .toolbar(removing: .sidebarToggle)
        } detail: {
            Text("detail")
        }
        .introspect(.navigationSplitView, on: .macOS(.v13,.v14,.v15)) { splitview in
            if let delegate = splitview.delegate as? NSSplitViewController {
                delegate.splitViewItems.first?.canCollapse = false
                delegate.splitViewItems.first?.canCollapseFromWindowResize = false
            }
        }

I don't really understant why @yu-zhao got down voted because that solution worked until the newest version of macos and xcode.

Reasons:
  • RegEx Blacklisted phrase (2): down vote
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @yu-zhao
  • Low reputation (1):
Posted by: magic_sk