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.

Filter by
Sorted by
Tagged with
12 votes
3 answers
5k views

Only root-level navigation destinations are effective for a navigation stack with a homogeneous path

I am trying to integrate NavigationStack in my SwiftUI app. I have four views: CealUIApp, OnBoardingView, UserTypeView and RegisterView. I want to navigate from OnBoardingView to UserTypeView when ...
BraveEvidence's user avatar
6 votes
1 answer
3k views

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 ...
Collin Allen's user avatar
  • 4,537
9 votes
2 answers
6k views

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 ...
Ákos Morvai's user avatar
3 votes
1 answer
2k views

(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 ...
Huntare's user avatar
  • 41
2 votes
1 answer
890 views

A complex Navigation with NavigationPath in SwiftUI

The usual flow is the stack. Push views and pop views. My requirements is a bit complex and I did not find a way to do it in IOS 16. Let say we have a Cover page Contents page Details page Now, the ...
kelalaka's user avatar
  • 5,350
1 vote
1 answer
1k views

Found a strange behaviour of @State when combined to the new Navigation Stack - Is it a bug or am I doing it wrong?

I have transitioned my swiftui app to the new NavigationStack programmatically managed using NavigationStack(path: $visibilityStack). While doing so, I found an unexpected behaviour of @State that ...
Adkarma's user avatar
  • 23
0 votes
2 answers
666 views

How to do programmatic navigation in swiftui using navigationstack once state changes?

struct LoginView: View { @State var isUserLoggedIn = false NavigationStack{ //..... Button { Task{ await viewModel.doLogin(email: ...
Chup bae's user avatar
25 votes
2 answers
6k views

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 ...
Mgwd's user avatar
  • 512
9 votes
4 answers
2k views

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 ...
Andre's user avatar
  • 672
6 votes
1 answer
5k views

NavigationStack in combination with a TabView (SwiftUI, iOS16)

What is the correct way to combine the mentioned views. As of now, i have a NavigationStack at the bottom of my app. It displays a LaunchView as root. When a user is authenticated, the main view is ...
Lukas's user avatar
  • 480
4 votes
1 answer
252 views

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 ...
Kevin D's user avatar
  • 138
3 votes
2 answers
1k views

.searchable() - make the search box stick to the top without moving when focused

I am trying to make the search box in .searchable stick to the top without moving when there is no navigationBarTitle. Basically, when the box gets focused, there is an animation that moves the box ...
lagoupo's user avatar
  • 77
2 votes
1 answer
1k views

NavigationStack Searchable .focused

I need to configure when the user clicks in the Search box to fulfill the condition (display another View). Once he clicks Cancel to display the original view (which can already be tested via ....
Aleš Slabý's user avatar
2 votes
1 answer
479 views

How to use the new NavigationStack for navigation in SwiftUI 4+ (iOS 16+)

I've read the documentation on the topic and I believe I have a basic understanding of it. In theory, it sound pretty good, and not too complex. If i have a model class ModelClass and a view to ...
Tommmy's user avatar
  • 23
2 votes
1 answer
771 views

Why are objects still in memory after emptying NavigationStack path?

I'm trying to implement a Coordinator for managing a flow. The state is stored inside the CoordinatorStore. There are 2 @Published properties for managing the flow. The screen property controls which ...
hydro1337x's user avatar
1 vote
0 answers
876 views

Path of NavigationStack inside NavigationSplitView emptied on change

I have the following view inside WindowGroup: struct SidebarSelection: View { @State var selection: Int? @State var path: [Int] = [] var body: some View { ...
Dominik's user avatar
  • 746
1 vote
1 answer
369 views

NavigationStack programatically appending childviews with different types

I have a NavigationStack with parent view struct MainDatabaseView: View { @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { List { ...
Petr Smejkal's user avatar
0 votes
1 answer
599 views

Make Custom SwiftUI Views with ObservedObjects compatible with NavigationLink iOS 16

I don't feel that the following example is exhaustive (from Hacking With Swift). A lot of online examples tend to keep it quite elementary like this, where NavigationLinks are implemented based off of ...
Andre's user avatar
  • 672
0 votes
1 answer
2k views

NavigationStack iOS16 with Route, how to pop back to root?

I have the following navigation stack using route to go to differnet views: import SwiftUI import FirebaseAuth import WebKit enum Route:String, Hashable { case linkSettings, linkWallet } ...
Pro Girl's user avatar
  • 882