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
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
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
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
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
9 votes
2 answers
4k views

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: $...
bjorn.lau's user avatar
  • 1,013
9 votes
0 answers
1k views

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 ...
Jack Rogers's user avatar
7 votes
1 answer
4k views

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 ...
Aaron Bratcher'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
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
6 votes
1 answer
1k views

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 ...
Ákos Morvai's user avatar
6 votes
0 answers
2k views

Dealing with Nested NavigationStacks in SwiftUI?

I've looked around but haven't seen any info on this. If I want to have multiple navigation stacks in SwiftUI, and have multiple navigation links that add to different navigation stacks, how can I do ...
Nicolas Gimelli's user avatar
6 votes
0 answers
257 views

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 ...
Peter Lapisu's user avatar
  • 20.5k
5 votes
3 answers
4k views

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 ...
Samuel Davies's user avatar
5 votes
2 answers
494 views

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....
Basel's user avatar
  • 600
5 votes
1 answer
496 views

Animating transition in NavigationStack on macOS

I made a simple macOS application with NavigationStack and few views presented using NavigationLink(value:label:). It works really nice, except there is no animation at all. Is it possible to add ...
Damian Dudycz's user avatar
5 votes
0 answers
2k views

navigationDestination(isPresented) with a path in swiftui 4

Im trying to pop back to a specific view point or the root view with navigationDestination(isPresented) being used to push views. Here is a simpler version of the code I am working with import SwiftUI ...
EmeraldLockdown's user avatar
4 votes
1 answer
4k views

SwiftUI NavigationStack inside NavigationSplitView not working on iPhone and iPad

I'm trying to use NavigationStack inside NavigationSplitView. struct ContentView: View { @State var mainMenu: MenuItem? @State var subMenu: SubMenuItem? var body: some View { ...
ygee's user avatar
  • 2,950
4 votes
1 answer
973 views

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/...
M Alamin's user avatar
  • 317
4 votes
2 answers
4k views

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 ...
Anupam Mishra's user avatar
4 votes
2 answers
4k views

Using a custom background behind NavigationStack in SwiftUI

This ought to be straightforward enough, but I cannot find out how to place a background behind a NavigationStack. With NavigationView, it was simply a matter of embedding in a ZStack with the ...
Hyoryusha's user avatar
  • 197
4 votes
1 answer
4k views

New NavigationStack in SwiftUI transition, how to change from the default slide to custom or appear?

I have NavigationStack with its own navigation links, for iOS16 development. How to change the default slide transition to appear or a custom transition? Also do you apply the transition on the ...
Pro Girl's user avatar
  • 882
4 votes
4 answers
551 views

NavigationStack title loads inline instead of large when sheet is presented

One of my views loads in a bottom sheet. It has its own NavigationStack with a title. Problem is that whenever the view is loaded, the title (set on ".automatic") always loads ".inline&...
helloimbrando's user avatar
4 votes
1 answer
408 views

Changing the color of .searchable() elements

I am using the .searchable() modifier on a NavigationStack. I want to change the color of the cancel button as it does not match with my app colors. How can I do this? This is what I already tried ...
lagoupo's user avatar
  • 77
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
4 votes
1 answer
255 views

IOS 17 NavigationStack bug? - EditButton does not perform as expected in a NavigationStack

This performs as expected, the selection triggers right away struct ListSelectionTest: View { @State var selection: Set<String> = [] let strings = ["One", "Two", "...
Easterdown's user avatar
4 votes
1 answer
681 views

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 ...
SwiftedMind's user avatar
  • 4,061
4 votes
3 answers
1k views

NavigationLink Causing Freeze @ 99% Debug CPU

I am new to Swift and SwiftUI and working on an app that requires passing nested bindings through various views. I'm encountering an issue where a NavigationLink in a subview passing a binding to a ...
mmmmmatt's user avatar
4 votes
2 answers
388 views

Popping from NavigationStack clears screen before disappearing

For some reason, clearing a navigation stack gives an unintended animation when compared to dismissing regularly. It clears the screen before it actually animates away. How can you pop back to root ...
fballjeff's user avatar
  • 382
4 votes
0 answers
614 views

How to fix infinite loop in navigationDestination, why this happens?

What's wrong with navigationDestination with binding on ios 16? I have an infinite loop in nested navigation with binding and navigation stack struct Visit: Identifiable, Hashable { var id: String ...
hitrain's user avatar
  • 163
4 votes
0 answers
109 views

NavigationStack inside paged TabView is broken

I want to have horizontal paging with navigation bars on each page. Going with TabView, there is an issue in combination with page style when nesting NavigationStack. Let me show you an example. The ...
Borut Tomazin's user avatar
4 votes
0 answers
269 views

Infinite loop by using @Binding when passing data between views

High-level description: There is a nested view problem when a state object is being passed through views. At the end of the deepest view in the hierarchy, the app is frozen and memory consumption is ...
vargab's user avatar
  • 121
3 votes
1 answer
927 views

SwiftUI using .NavigationDestination is making the app go back on the view after pressing the button

After changing the code to use NavigationStack and list to list clickable items which open a different View. Clicking the item changes the view for a second and then bounces back to HomeView. HomeView....
Aniruddha Pandit'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
3 votes
1 answer
1k views

How to go to different Views with with navigationDestination modifier for the NavigationStack for iOS 16?

I am trying to go to 2 differnt views from the NavigationStack by usgin differnt navigationDestination modifier, however I am always getting directed to the same destination. How to fix it? Here is my ...
Pro Girl's user avatar
  • 882
3 votes
2 answers
2k views

Why NavigationStack with NavigationPath calls navigationDestination multiple times on path append?

The navigationDestination is being called a single time when using an array of type (ie: [String]) but multiple times when using NavigationPath after an append. Check it with a breakpoint on Text(...
JS1010111's user avatar
  • 429
3 votes
1 answer
835 views

navigate with NavigationStack swiftUI

I am new to SwiftUI framework I am trying to implement NavigationStack. I want to navigate on button action instead of using NavigationLink. The reason behind that is, I need to navigate once a ...
Ajay Sharma's user avatar
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
3 votes
2 answers
1k views

SwiftUI NavigationStack animation problem when navigating back to parent view

I have a parent view with a NavigationStack containing a List with NavigationLinks, the NavigationStack have a large title. These NavLinks go to an other List with Sections in it, this List have a ...
simsab's user avatar
  • 121
3 votes
1 answer
552 views

Why does the navigation title change from large to "scrolled" when popping a NavigationLink inside a NavigationStack on iOS 16?

I have run into some unexpected behavior when using a NavigationLink inside a NavigationStack. If I navigate from a view with a large navigation title to a view with an inline title, the title display ...
jus10's user avatar
  • 31
3 votes
2 answers
400 views

NavigationLink fires more one times in NavigationStack

I faced the problem when NavTestChildView called more one times. I don't understand what going wrong. I tested on a real device with iOS 16.0.3 and emulator Xcode 14.0.1 I replaced original code to ...
Victor Kushnerov's user avatar
3 votes
0 answers
621 views

Are multiple NavigationStacks allowed in SwiftUI for nested navigation scenarios while utilizing .toolbar modifier?

I am working on a SwiftUI application where I have a list of items on the main screen. When an item is selected, it navigates to a detailed view of that item. On this detailed view, there are other ...
Timo's user avatar
  • 31
3 votes
1 answer
282 views

SwiftUI navigation router issues

I have a simple navigation router: @Observable class BaseRouter { var path = NavigationPath() var isEmpty: Bool { return path.isEmpty } func navigateBack() { path....
ItayAmza's user avatar
  • 919
3 votes
0 answers
272 views

How to use Navigation Stack with a Protocol as the data type?

I have a List that iterates over an array of protocols and creates a NavigationLink for each protocol, with a label that displays a field of the protocol. When trying to use the .navigationDestination ...
yambo's user avatar
  • 1,667
3 votes
0 answers
384 views

Moving between NavigationStacks(path:...) throwing "Update NavigationAuthority bound path tried to update multiple times per frame."

I have a segmented picker on my main page allowing the user to select between views to be loaded into that main view. Each of those views has a NavigationStack with a path. Moving between them results ...
Ricardo B.'s user avatar
3 votes
0 answers
428 views

SwiftUI: Customizing the Native Navigation Bar in SwiftUI to Mimic the Apple TV App's Style and Animations - iOS 16

How can I customize the native navigation bar in SwiftUI to resemble the one used in the Apple TV app for iOS? On the detail screen, there's a native navigation bar where the tint color of the toolbar ...
Yatheesha's user avatar
  • 10.4k
3 votes
2 answers
1k views

NavigationStack inside TabView inside NavigationStack does not work

I want to have a root NavigationStack that lets the user navigate around a SwiftUI app, including to a TabView with tabs that have their own navigation stack. Unfortunately, this seems to not work at ...
Greg Ennis's user avatar
  • 15.2k
3 votes
1 answer
225 views

Search Bar is briefly visible when navigating with NavigationStack (SwiftUI)

I have a .searchable modifier on a list where I navigate to with new NavigationStack. However when the view loads the search box is briefly visible which looks weird. Am I using the navigation stack ...
Can Celik's user avatar
  • 2,067
3 votes
2 answers
896 views

SwiftUI: searchable weird push animation?

I have the following code: enum ContentViewRouter { case details } struct ContentView: View { var body: some View { NavigationStack { ZStack { ...
zumzum's user avatar
  • 19.1k
3 votes
0 answers
283 views

NavigationStack: Destination not updated on path removal during animation

In my application I am using a custom navigation bar which, besides other functionality, allows the user to navigate back. I am using a NavigationStack with an array with enums as path. On navigating ...
J. Cervus's user avatar
  • 205
3 votes
1 answer
709 views

SwiftUI 4.0 - Passing a Binding via .navigationDestination(for: , destination: )

How do I pass a Binding via the new .navigationDestination(for: , destination: )? import SwiftUI enum TestEnum: String, Hashable, CaseIterable { case first, second, third } struct ContentView: ...
Peanutsmasher's user avatar

1
2 3 4 5 6