Questions tagged [swiftui-navigationstack]

For questions about SwiftUI's NavigationStack, a view that displays a root view and enables you to present additional views over the root view.

198 questions
21
votes
2 answers

Why doesn't clearing the new iOS 16 SwiftUI NavigationPath to "pop to root" animate smoothly back to the root view?

I have a new iOS 16 SwiftUI NavigationStack with navigation determined by the NavigationDestination modifier which works fine. My question is why doesn't it animate smoothly by sliding back to the root view when clearing the NavigationPath if you…
Mgwd
  • 452
  • 3
  • 10
9
votes
2 answers

SwiftUI - IOS 16 - How to use new NavigationStack and NavigationPath for programatic navigation in MVVM architecture?

Description For programatic navigation you could previously use NavigationLink(isActive:, destination:, label:) which would fire navigation when the isActive param is true. In IOS 16 this became deprecated and NavigationStack, NavigationLink(value:,…
Ákos Morvai
  • 171
  • 1
  • 5
8
votes
0 answers

Why does the navigation title display mode change from large to inline when popped in iOS 16?

When I pop from a pushed view that has a display mode of inline the display mode of the parent view which was originally large is changed to inline and the user has to scroll down for the title to revert back to its original mode. Q: How do I…
7
votes
4 answers

Incomplete Swipe-back gesture causes NavigationPath mismanagement

I am looking for solutions to the following bug in my example code below. I have tried to implement the Navigator Pattern with SwiftUI 4 and the iOS 16.0 Navigation API changeset. The example below will compile in Xcode 14.0+ and if run in simulator…
6
votes
0 answers

macOS NavigationStack use push and pop animation

how to set the Push / Pop animation in macOS for a NavigationStack ? as currently there is no animation and i want to push / pop the controller sliding right (sliding left), similar to AppStore app enum Nav { case a } struct MainView: View { …
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
6
votes
1 answer

SwiftUI - IOS 16 NavigationStack - @StateObject init called twice

Description I am trying to adapt my application to the new NavigationStack introduced in IOS 16. I ended up with a strange behaviour when I have a @StateObject variable in one of my views. When I navigate (using the new .navigationDestination()…
Ákos Morvai
  • 171
  • 1
  • 5
6
votes
1 answer

NavigationStack not affected by EnvironmentObject changes

I'm attempting to use @EnvironmentObject to pass an @Published navigation path into a SwiftUI NavigationStack using a simple wrapper ObservableObject, and the code builds without issue, but working with the @EnvironmentObject has no effect. Here's a…
Collin Allen
  • 4,449
  • 3
  • 37
  • 52
6
votes
1 answer

How am I misusing NavigationStack?

I have this tiny sample of code in trying to use the new NavigationStack, but I get an error: A NavigationLink is presenting a value of type “TransactionRoute” but there is no matching navigation destination visible from the location of the link.…
Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
5
votes
2 answers

Presenting a sheet view with NavigationStack in SwiftUI

I am trying to figure out if there is a way to open a sheet with the new NavigationStack in iOS 16, but can't seem to find a way. So of cause, it's possible to open a sheet using: .sheet(isPresented: $isShowing) But with the new NavigationStack you…
bjorn.lau
  • 774
  • 5
  • 16
4
votes
1 answer

Is it possible it use a link in a SwiftUI AttributedString to navigate to another view in the same app?

I know with AttributedString, I can link to an external website using something like: Text("To learn more about AttributedString visit [this page](https://developer.apple.com/documentation/foundation/attributedstring/)") Can I use this to go from…
M Alamin
  • 307
  • 2
  • 10
4
votes
1 answer

Navigation bug when dismissing view while focussing on empty .searchable() modifier

When trying to navigate back from a view using the environment Dismiss value while also focussing on an empty searchable modifier the view you navigated back to becomes unresponsive. This is due to an empty UIView blocking any interaction with the…
4
votes
1 answer

NavigationStack is not showing initial navigation path when presented in a sheet

I want to present a view with a NavigationStack that has an initial path. This almost always works, but not when that view is presented as a sheet. Then, it only shows the root view of the NavigationStack. Here is a fully working example: struct…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
4
votes
2 answers

How to pop to root view via navigation stack in iOS 16

As we know Apple have introduced NavigationStack in SwiftUI available from iOS16.* Let say I have created ViewA, ViewB, ViewC, ViewD And now I have navigated like ViewA->ViewB->ViewC->ViewD Now I am looking to pop to root view i.e on ViewA from…
Anupam Mishra
  • 3,408
  • 5
  • 35
  • 63
4
votes
1 answer

How to avoid rebuild view when tap on different button on NavigationSplitView

I have tried apple example Bringing robust navigation structure to your SwiftUI app so my code looks like this NavigationSplitView( columnVisibility: $navigationModel.columnVisibility ) { List( …
3
votes
3 answers

SwiftUI a navigationDestination was declared earlier on the stack when pushing new value to the NavigationStack

I am trying to recreate the account followers flow seen in many social media apps in SwiftUI. You press a button on your profile to see a list of your followers You can click on any one of your followers to see their account You can press a button…
1
2 3
13 14