For questions about SwiftUI's NavigationStack
, a view that displays a root view and enables you to present additional views over the root view.
Questions tagged [swiftui-navigationstack]
198 questions
1
vote
1 answer
(2023) NavigationStack and NavigationDestination, using NavigationPath Correctly
I am trying to accomplish a relatively simple task. I want to navigate from a root view -> intermediate view that captures input -> final view that displays input -> back to root view.
The solution I came up with uses the new NavigationPath and…

Huntare
- 21
- 3
1
vote
0 answers
SwiftUI - NavigationStack: Why my NavigationPath() is printing the wrong path.count?
I have the following basic utilization of NavigationStack with SwiftUI for iOS 16, Xcode.
The issues I am facing is that when I click back and printing the count, the root count is wrong and shows as "1" instead of always showing as "0".
Why and how…

Pro Girl
- 762
- 7
- 21
1
vote
0 answers
Use NavigationStack + NavigationLink + .navigationDestination without Hashable conformation
Consider the following code,
import SwiftUI
class Product: Identifiable {
let id = UUID()
let title: String
init(title: String) {
self.title = title
}
}
struct ContentView: View {
let products: [Product]
…

Adrian Föder
- 770
- 1
- 7
- 22
1
vote
0 answers
SwiftUI hanging with @Environment and NavigationStack when passing Bindings
I've got a NavigationStack and I'm passing bindings to multiple children through a couple of different views. If I don't pass the children as bindings then everything works as intended. Also if I uncomment the @Environment aspect, everything works…

dwl96
- 11
- 3
1
vote
1 answer
SwiftUI NavigationStack Navigation
I'm trying to use NavigationStack for Navigation for my SwiftUI Project. I have 4 Screens in total. The Main Page of my App has Login and Sign up Buttons. If the user signs in successfully the App takes the user to the Home Page where the User can…

Amey079
- 131
- 7
1
vote
0 answers
SwiftUI] access multiple NavigationStack
I use TabView & NavigationStack. TabView covered NavigationStack & inner View also covered NavigationStack. I want an inner navigation Push but it's always the root Navigation Push (in TabViewTest). Can I push the inner NavigationStack View (in…

이기완
- 11
- 2
1
vote
1 answer
SwiftUI - NavigationStack not working as expected
For some reason, my NavigationStack is bugging out when clicking through. I have changed NavigationView -> NavigationStack by it seems to be more complicated than anticipated and would greatly appreciate the help.
In one of my Views the…

DogDogDog
- 13
- 2
1
vote
1 answer
SwiftUI - Unable to navigate to next View from List/NavigationLink with navigationDestination
My first View represents a login screen, which then takes you to the home View. I've read through the documentation and watched WWDC22 - The SwiftUI cookbook for navigation which got me on the right track, but I'm unable to navigate past the home…

Joe G
- 51
- 1
- 7
1
vote
1 answer
How to call Task in NavigationLink destination in SwiftUI?
I've created a list using LazyVStack and inside of the list there are ListItemViews.
What I'm trying to do is, when a ListItemView gets tapped, I want to make an async call depending on the selected item, and then navigate to the view with the data…

Burak Akyalçın
- 302
- 5
- 26
1
vote
1 answer
SwiftUI: Form pushes all navigation links on navigation stack
The idea is to use a Settings View in my App using a Form. However, it seems the Form itself pushes all NavigationLinks from the List view onto the navigation stack (at once). The typical (correct?) expected behaviour when not wrapped in a Form, is…

RG128
- 211
- 2
- 6
1
vote
0 answers
How do I use NavigationStack on iOS 16 so that I don't have to explicitly create a Link with label that needs to be pressed?
I have a view that has a loading animation, basically when that call is done I want to automatically navigate to the following screen. Before with the isActive parameter I could create an empty view for the link and easily just toggle the bool value…

kenada97
- 19
- 3
1
vote
1 answer
Push user to a logged in view not working
For iOS16+, I am using Google Sign In button on ContentView to authenticate users. If users are not authenticated, the button shows and user can go through the authentication process. Once authenticated, user is brought back to ContentView that also…

revvy
- 151
- 3
- 16
1
vote
2 answers
NavigationStack pushing too many views
Hello I am fairly new to swiftui and I am creating a NavigationStack from an array of items. Every item in the array is pushed into navigation when I click on the item (I have to click the back button many times to get back to the root) I can't seem…

John Citrowske
- 75
- 4
1
vote
0 answers
SwiftUI passing TabView binding variable around in global EnvironmentObject
I've got a SwiftUI issue that only surfaces in a complex scenario.
My application has a TabView near the top of the view structure. There are 5 tabs in total. Tab 1 and 5 are pretty simple ScrollView type views called Home and Account. Tabs 2,3,4…

Stanton
- 904
- 10
- 25
1
vote
1 answer
SwiftUI NavigationStack NavigationLink same Value, multiple destinations
I have a model like so...
struct User: Codable {
let followersCount: Int
let followingCount: Int
}
Using NavigationStack I would like to be able to use NavigationLink based on Value
NavigationLink(value: user.followersCount) {
…

Dan
- 543
- 2
- 13