johnpatrickmorgan / FlowStacks

FlowStacks allows you to hoist SwiftUI navigation and presentation state into a Coordinator
MIT License
857 stars 66 forks source link

iPad sidebar support #7

Closed iOSappssolutions closed 2 years ago

iOSappssolutions commented 2 years ago

Hello, I examined framework (great job imo looks very good), I had problem to run it on iPad with sidebar, is there going to be version that supports iPad and sidebar? (maybe I'm doing something wrong)

p.s.

on iPad it's just pushing new views on sidebar part of screen instead of making selection.

johnpatrickmorgan commented 2 years ago

Hi, thanks for your interest in this library. Currently the library sets .isDetailLink(false) on screens on iOS. Unfortunately, this is necessary, as SwiftUI triggers some unexpected state updates without that. This doesn't cause issues for a navigationViewStyle of .stack, but for .columns, I'm afraid it produces the behaviour you've described on iPad. I will look into whether there is a better approach. Thanks for raising this issue.

iOSappssolutions commented 2 years ago

Thanks for investing time to give answer, I was thinking since in my project I'm using

public init<V>(destination: Destination, tag: V, selection: Binding<V?>, @ViewBuilder label: () -> Label) where V : Hashable

to initialise NavigationLink for sidebar, maybe that is the key to have same level nodes that are on same level and that can stack other nodes on top as well. I will play on my own if I figure something out I will let you know in case it helps.

Appreciate your hard work, best regards.

johnpatrickmorgan commented 2 years ago

I played around with trying to support .navigationViewStyle(.columns), but its model of navigation doesn't really fit with this library's handling of navigation via an array, e.g. 'popping' a detail link does not remove the screen from view. For this reason, the latest version of the library limits the navigationViewStyle to .stack, and that's listed as a limitation. Perhaps in future this will be something that can be supported. Thanks for raising this issue, sorry not to be more help. 🙂