NavigationBackport icon indicating copy to clipboard operation
NavigationBackport copied to clipboard

Could you support NavigationSplitView ?

Open X901 opened this issue 3 years ago • 6 comments

Hi, I want to use your library but my app support iPhone and iPad so I need to depend on NavigationSplitView not NavigationStack

Could you support it ?

X901 avatar Nov 15 '22 13:11 X901

Hi @X901, thanks for raising this. I've opened a PR #28 with support for NBNavigationSplitView, albeit with limitations. If you have a chance to check out the branch and try it out, I'd be grateful for any feedback. Thanks!

johnpatrickmorgan avatar Dec 17 '22 23:12 johnpatrickmorgan

Hi, I was on vacation, I will try it tomorrow, and give you feedback 👏

X901 avatar Jan 04 '23 14:01 X901

I was trying this example

Screenshot 2023-01-05 at 10 45 10 AM

but I got this error on iPhone and iPad

Screenshot 2023-01-05 at 10 46 22 AM

X901 avatar Jan 05 '23 07:01 X901

Thanks for checking it out @X901 ! The example code you referenced is a little strange, as it sets up a selection property, but doesn't actually use it to show the detail; instead it uses NavigationLink. If you change the sidebarContent to:

    List([DemoScreen.first, .second, .third], id: \.self, selection: $selection) { page in
      Text(page.title)
    }

then it will work as expected (for both NavigationSplitView and NBNavigationSplitView) using the selection property rather than a NavigationLink.

Whilst NavigationLinks can be embedded in the sidebar of a NavigationSplitView, this isn't supported in NBNavigationSplitView. They can only be embedded in a NBNavigationStack in the detail pane. It might be possible to support that in the future.

Thanks for raising this, as I realise this ought to be documented better.

johnpatrickmorgan avatar Jan 05 '23 23:01 johnpatrickmorgan

Adding a +1 to using NBNavigationLink in the sidebar somehow. I currently don't use a selection property for my navigation but, instead, use NavigationLink with the older NavigationView with a 2-column set up. I'd love to use this for programmatic navigation with iOS 14 support if possible.

JoshHrach avatar Feb 18 '23 06:02 JoshHrach

Hi, Your library works well for us and we would love to also use a back port of the NavigationSplitView. The issue is quite old so I was wondering if you still had support for this in mind ?

Thank you for your great work 🙏

PhilippeWeidmann avatar Mar 05 '24 14:03 PhilippeWeidmann

I played with the idea of recreating NavigationSplitView using NavigationView but there are a lot of subtle ways NavigationSplitView can be used, and I don't think its full functionality can be recreated acceptably well, so I'm afraid it will remain out of the scope of this library.

johnpatrickmorgan avatar Aug 25 '24 14:08 johnpatrickmorgan

Thank you for checking anyways, @johnpatrickmorgan. Given the age of the navigation APIs, I know I personally was ready to move to support iOS 16+. Hopefully others affected here will be able to do the same soon, too.

JoshHrach avatar Aug 26 '24 00:08 JoshHrach