Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opt-in usage of sidebar in NavigationStack/NavigationView #4

Open
orchetect opened this issue Feb 24, 2023 · 6 comments
Open

Add opt-in usage of sidebar in NavigationStack/NavigationView #4

orchetect opened this issue Feb 24, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@orchetect
Copy link
Contributor

orchetect commented Feb 24, 2023

This is a fantastic library and just the thing I was looking for recently.

I am building a macOS app and I'm working on a refactor of Setting to allow the use of the sidebar as the top level, very much like how macOS Ventura's System Settings does:

macos-settings

It started as a small refactor (WIP) of the SettingExample project to use NavigationView with a sidebar instead of TabView:

setting-sidebar

But then I realized it would be much nicer if the sidebar was actually an opt-in feature of Setting. The reason is that right now, the text search function only searches within the scope of the current top-level item selected, not across all of them at once.

Additionally, in macOS Settings, the search bar is positioned within the sidebar (which doesn't really work on macOS) and its text search filters the sidebar contents during searching.

@aheze
Copy link
Owner

aheze commented Feb 24, 2023

Good points. The tab bar was supposed to just be for demo purposes — there's 4 tabs that each contain a separate instance of Setting. I was trying to mock up different scenarios where you'd use the library.

Instead, maybe the sidebar should contain the top-level list of settings, like this?

Sidebar on left, detail on right

It'll be a master-detail presentation style. This is possible in iOS 16 / macOS Ventura using NavigationSplitView.

@aheze aheze added the enhancement New feature or request label Feb 24, 2023
@orchetect
Copy link
Contributor Author

orchetect commented Feb 24, 2023

I'm trying to maintain current compatibility if possible so I'm using NavigationSplitView for the newer platforms and NavigationView for the older ones.

I have a somewhat workable prototype now, but it's proving challenging to adapt the existing code.

@orchetect
Copy link
Contributor Author

I'm going to put a pin in this and circle back later - there's other projects needing attention. If you feel inclined to attempt implementing any of this feel free of course. I love the concept of this library and you've done really great work. I think the extra touch of making it truly feel at home on macOS could definitely take it to the next level.

@DanBurkhardt
Copy link

@orchetect can you share the refactoring work you did? Sounds like a great idea, I'm trying to build something with the same UI right now and also finding it difficult to refactor my own fork.

Happy to look at picking up where you left off if you can share a link.

@orchetect
Copy link
Contributor Author

@DanBurkhardt I didn't get very far at the time. Got pulled onto other projects and also ran into some roadblocks that were making it evident that a proper refactor to add macOS look and feel was going to be a lot more work than it seemed.

I don't think there's anything useful in my old fork honestly. It would be best to just fork and start from scratch.

@DanBurkhardt
Copy link

I actually figured it out last night, how to force the thing to present as a Swift UI view with NSHostingController, and properly navigate with a back button / maintaining the navigation stack.

Will link to my fork after I clean

it up and ship it, it's a little hacky and tbh I don't fully understand why it works, but it does.

kassandra-settings-fixed.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants