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
0
votes
1 answer
SwiftUI - .navigationTitle and .toolbar not showing up
I'm following Apple's SwiftUI tutorial and currently stuck on this chapter. I'm trying to add a navigation title and toolbar to this View but it isn't showing up for some reason.
Here's my code:
import SwiftUI
struct ScrumsView: View {
let…

NQ2Resq
- 23
- 1
- 4
0
votes
1 answer
Does anybody have a working NavigationSplitView with NavigationStack in Details View?
No matter how it is set up, a complex 3 Columns NavigationSplitView with NavigationStack crashes or has inconsistent workflow.
Sidebar selection determines which content (or feature) is in Content.
Content (or feature) who is live (or selected)…

GeorgeJ
- 156
- 2
- 11
0
votes
0 answers
Open a view on the top of the navigation stack from a nested child view
I am looking to present a new view properly on top of the navigation stack in SwiftUI.
If I have a navigation stack, with A being the root view:
A -> B -> C -> D -> E
In this scenario, I have a method on view B that has an onOpenURL(perform:)…
0
votes
0 answers
Swift navigate back to root
I have a small game app that uses a navigation Stack to show different views.
This is the home file
NavigationStack {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
…

Cruder
- 29
- 5
0
votes
0 answers
Faking a modal with transparency with a ZStack, inside a Navigation Stack, doesnt hide the navigation back button. How can I hide it?
Scenario:
I have a screen with an NavigationStack, after going to the second screen, The back button of the NavigationStack appears. In that screen, by clicking the button "Toggle View", a fake modal appears with an opacity animation. Everything ok…

CarlosAndres
- 585
- 1
- 5
- 14
0
votes
0 answers
ToobarItems are not aligning by their bottom edges
I am trying to get both the leading toolbar item and the principal toolbar item to align by their bottom edges. I tried using spacers to push to bottom of their space. I put borders around the items for visual purposes. Looks like the leading…

Adam
- 2,070
- 1
- 14
- 18
0
votes
0 answers
Scrolling of the List in a view not applied to the list in its ViewModifier
I'm trying to implement an app where one of the views is a list with many elements. Thus it must be able to scroll. On the toolbar I have a switch to conditionally apply a ViewModifier that displays the same list and a Rectangle() in an HStack.
My…

Y4nn
- 1
- 1
0
votes
1 answer
SwiftUI - Undo a backwards move in a NavigationStack
When I navigate backward (like swiping the view from the left), I want to be able to swipe it back from the right to move to that previous view. Sort of like an undo stack.
Is it possible to use NavigationStack or other existing views to solve that?

roydbt
- 91
- 1
- 8
0
votes
0 answers
How can I fix the back button in navigation stack while swiping back
So when I navigate to Settings it shows a blue Back button. But when I swipe over to go back instead of pressing it. the button wiggles all over the place.
In the iPhone settings app the back button stays in place and slowly fades based on how…

ProtonFission
- 29
- 3
0
votes
0 answers
NavigationStack's path are being emptied when NavigationStack disappears
In the executable code below I try to implement the main navigation view for an (iPadOS) app. The expected behaviour is as follows:
A NavigationSplitView is used to present a sidebar to the user containing the main categories of the app
If a user…

san
- 31
- 6
0
votes
1 answer
NavigationStack in TabView causing changes to header space in child views
When I put a NavigationStack in a TabView in SwiftUI, the child views have improper spacing at the top of each view. This only happens when I move to another tab and return back. Also it only occurs when I initialize TabView with TabView(selection:…

Emet Amil
- 1
- 1
0
votes
0 answers
Adding full width swipe to go back in SwiftUI
I have been struggling to implement a swipe-from-anywhere to go back gesture with the latest SwiftUI.
I found relevant posts like this: Swipe to go back only works on edge of screen?
But they utilize UIViewControllers, when my application uses just…
0
votes
0 answers
Using NavigationStack for simple navigation to 2 views
Newbie here..
I've been watching a few tutorials on NavigationStack and had a question..
How do I implement a very simple navigation to a second view?
I have 2 buttons - a 'Play' button that should navigate to 'GameView' and an 'Options' button that…

TheDoctor
- 13
- 4
0
votes
1 answer
SwiftUI: NavigationStack appends all items of list
I have a NavigationStack in SwiftUI and an ObservedObject and enum that handle the routing.
enum Route {
case location(location: Location)
}
extension Route: Hashable {
func hash(into hasher: inout Hasher) {
…

HarryMoy
- 142
- 3
- 20
0
votes
0 answers
Add space between NavigationStack toolbar and other elements
I am trying to add space between the yellow toolbar and the MiniView element below. When I add space, it looks like it extends the toolbar.
The space needs to be similar to the space between the MiniView and List.
import SwiftUI
struct AnotherView:…

thenakulchawla
- 5,024
- 7
- 30
- 42