mmohobo / SidebarToggle

Sample SwiftUI code to restore the macOS NavigationList sidebar gracefully.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SidebarToggle

Sample SwiftUI code to restore the macOS NavigationList sidebar gracefully.

When using a NavigationView in SwiftUI on macOS, it's possible for the user to drag the sidebar closed and not be able to reopen it. This sample code provides 2 methods to do so. Firstly, by adding Sidebar Commands to the app's View menu, and secondly by introducing a toggle on the NavigationView toolbar with the appropriate icon and location so as to be intuitive for the user.

This is not a complete Xcode project, just sample .swift files.

Shout out to this article for the info.

About

Sample SwiftUI code to restore the macOS NavigationList sidebar gracefully.

License:MIT License


Languages

Language:Swift 100.0%