{"id":16210266,"url":"https://github.com/winsmith/threepanelexample","last_synced_at":"2025-04-07T21:18:35.938Z","repository":{"id":145659018,"uuid":"375064746","full_name":"winsmith/threepanelexample","owner":"winsmith","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-08T20:14:02.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T22:45:12.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winsmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-08T15:49:36.000Z","updated_at":"2022-06-23T18:05:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"2091dabb-c3c9-4088-a06b-3a8896800163","html_url":"https://github.com/winsmith/threepanelexample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winsmith%2Fthreepanelexample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winsmith%2Fthreepanelexample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winsmith%2Fthreepanelexample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winsmith%2Fthreepanelexample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winsmith","download_url":"https://codeload.github.com/winsmith/threepanelexample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247730064,"owners_count":20986404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T10:36:35.044Z","updated_at":"2025-04-07T21:18:35.916Z","avatar_url":"https://github.com/winsmith.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"1378\" alt=\"Screenshot 2021-06-08 at 22 12 54\" src=\"https://user-images.githubusercontent.com/954120/121251022-b44cf200-c8a6-11eb-927f-efff69bc2d4c.png\"\u003e\n\n# Add ability to toggle sidebars in three-pane-layout\n\n- Area: SwiftUI Framework\n- Type of Issue: Suggestion\n- Feeback ID: FB9139587\n\nWhen creating a destination-based Navigation View by using the init(content:)\ninitializer of NavigationView, I can easily create two-pane or three-pane navigation,\nto create app layouts similar to the Apple Mail app for example: Two small sidebars,\nand then a rightmost content area that is larger and more important. \n\nIn my macOS app, I would like to imitate a different type of layout, similar to the\nXcode app: Main content in the middle, and two narrow, toggleable sidebars left and\nright.\n\nCurrently, there is no what to easily achieve this kind of layout in SwiftUI, and\nI'd like to suggest that there should be. \n\nI've created a sample project that approximates the kind of layout I'd like to \nachieve. The approximation uses various clunky techniques like walking down the\nNSApp.window's responder chain until we find an object of class \nNSSplitViewController. I hope the SwiftUI will find better solutions for these \nkinds of problems.\n\n## Sample Project\n\nThe sample project shows a macOS app that has both a left sidebar, and a right sidebar.\nNavigation flows from left to right, just as with any split view. However, unlike\nmost apps that use the three-pane layout, it is important to me that the left and\nright sidebars are smaller than the main content view in the center.\n\nThis way, the content of the middle pane is the most important, with the rightmost\nsidebar a sort of inspector to change details of my selection without using up too\nmuch space.\n\nThis example project uses a lot of unsafe introspection to approximate my goal: A\nthree-pane layout just like the one in Xcode, with toggleable sidebars. My hope is\nthat the SwiftUI team will find a more elegant solution.\n\nToggling the left pane off or on needs introspection into NSApp.keyWindow and\nNSSplitViewItems, which is clunky and might be unsafe. I'd love a direct way to\naccess that from SwiftUI instead. (See LeftSidebarView.swift)\n\nToggling the right pane on or off is even more hacky: It requires a deep dive down\nthe responder chain with class comparison and optional casting and depends on the\nway that NSSplitViewController structures its subviews. It would be really cool to\nbe able to do that directly from SwiftUI. (See View+toggleSidebar.swift)\n\n## Minor Comments and improvement suggestions: \n- Toggling the right pane off and then on again has a missing animation.\n- I have to duplicate the right toolbar button so it shows up at the right spot\n  all the time. I wish I could just provide it once.\n- Placement of the left toolbar button jumps around a lot, and when I toggle it,\n  it sometimes disappears.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinsmith%2Fthreepanelexample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinsmith%2Fthreepanelexample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinsmith%2Fthreepanelexample/lists"}