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
0
votes
0 answers

How to access the NavigationStack of the current View, so that I can use it for modal > navigate to further views

I have two Views, ViewA and ViewB. Both of them are inside of NavigationStack and they are inside of a TabView. TabbarView: import SwiftUI struct TabbarView: View { var body: some View { TabView() { NavigationStack { …
Tulon
  • 4,011
  • 6
  • 36
  • 56
0
votes
0 answers

How to manually set the minimum version of watchOS to 9 and iOS to 16 in Xcode?

I am wanting to use navigation stack for my watch app but when building I keep getting the error "'NavigationStack' is only available in iOS 16.0 or newer" I understand I can simply wrap my code using if #available(iOS 16.0, *) {} and do the same…
0
votes
0 answers

Why NavigationStack changes animation behavior?

There are 2 pages in the demo main view with a navigation button to the the content view content view has a image overlaying a border animation. the problem is if it starts from launching app, then clicking the button, then it's weird of the…
CodeBoy
  • 591
  • 6
  • 12
0
votes
1 answer

SwiftUI - NavigationBar not animated on Push when there is no or empty title in the root view of a NavigationStack

I'm experiencing an issue with the NavigationBar in SwiftUI where it doesn't animate when Detail View is pushed and there is no or empty [navigation] title in the root view of a NavigationStack. Here is an example that reproduces the issue: // // …
apetrov
  • 430
  • 5
  • 16
0
votes
2 answers

NavigationStack with array from relationship

I am doing navigation stack for the array of related entries var body: some View { NavigationStack(path: $navPath){ VStack { List(Array(plant.event as! Set), id: \.self) { eventInList in …
user453575457
  • 464
  • 6
  • 21
0
votes
0 answers

NavigationStack not showing master-detail view on iPad in landscape

I've the following code which displays a master-detail view on iPad when in landscape. However, when I use NavigationStack it collapses views as on iPhone. What am I missing here? Or how to achieve this another way? struct OwnersView: View { …
M.Serag
  • 1,381
  • 1
  • 11
  • 15
0
votes
0 answers

Why is my navigation path not appending the model the further I go in?

I've implemented a navigation stack that appends the next view's view model so that the appending and .navigationDestination looks like the below. Whenever I press the continue button to add the viewModel to the path in the ContentView (the child of…
kenada97
  • 19
  • 3
0
votes
1 answer

How do I get rid of "A navigationDestination for AppExample.ViewOptions was declared earlier on the stack. Only the destination declared closest .."

I have implemented a navigation stack and enum following https://stackoverflow.com/a/74362840/21094465 yet I am still receiving the following "A navigationDestination for AppExample.GreaterViewOptions was declared earlier on the stack. Only the…
0
votes
0 answers

Go back to the RootView with a TabBar after several complex NavigationLink entries

I want to make a Quiz within my SwiftUI-App and I'm wondering how I can go back to the RootView (which has a TabBar) after asking several Questions. In theory my Quiz should work like This: First Go to the "Game" Tab on the TabBar Click the on the…
0
votes
0 answers

Dismissing nested navigation view which is over presented sheet is popping to sheet view instead of first navigation view

Currently in root view I have a presented a sheet. On click of button in presented sheet I am navigating to first view and then to second view and dismissing second view is landing on presented sheet rather than first view. Root View -> Presented…
0
votes
1 answer

NavigationStack embedded in View

In my app I have a View inside another, and I want to navigate to another view from the subview, with a NavigationStack. The problem is that the navigation takes place at the top view level. I only want to replace the subview with another subview…
0
votes
0 answers

Why does my new view automatically go back to the previous view in the stack?

I am trying to implement Apple's new NavigationStack and am having some trouble. I am able to navigate to the next view after a Bool gets set to true. Once I am in the next view however, it automatically goes back to the root view of the stack. The…
kenada97
  • 19
  • 3
0
votes
1 answer

NavigationStack has correct colors, but NavigationLink does not?

I have this app that uses a NavigationStack to change the colors of the toolbar. When a navigation link is clicked, the navigation colors are not preserved onto the new screen and it goes back to default. Here are 2 screenshot of what I mean: This…
ToxicFlame427
  • 355
  • 2
  • 13
0
votes
1 answer

Why different cell animation when popping initial NavigationStack path item?

With this test app: import SwiftUI enum Route { case first case second } @main struct NavigatorApp : App { @State private var path: [Route] = [.first] var body: some Scene { WindowGroup { …
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
0
votes
1 answer

Replicate deprecated NavigationLink behaviour within a NavigationStack

I'm in the midst of moving my app from iOS 15 to iOS 16. In my app ( iOS 15 ) I have a LogOn View (sysPassView) that automatically pops on first entry into my Navigation View using the following code: NavigationView { @State private var showLogin:…