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
2
votes
1 answer
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 {
NavigationSplitView {
…

ygee
- 2,580
- 3
- 17
- 21
1
vote
0 answers
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.removeLast()
}
func popToRoot() {
…

ItayAmza
- 819
- 9
- 21
1
vote
2 answers
.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 upward and I would like to prevent that from…

lagoupo
- 25
- 7
1
vote
1 answer
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 without luck:
accentcolor, tint, foregroundcolor,…

lagoupo
- 25
- 7
1
vote
1 answer
Increase padding to NavigationStack title causes weird issue
I have a set up like this:
NavigationStack {
List {
ForEach(allProjects) { project in
Section {
NavigationLink(destination: ProjectView()) {
ProjectRow(project: project)
}
…

Shawn Frank
- 4,381
- 2
- 19
- 29
1
vote
1 answer
How can I make a NavigationTitle in SwiftUI open a picker view?
I understand that you can bind a string to the navigation title like:
.navigationTitle($titleString)
and you get:
and this will allow you to rename it,
but is there a way to bind this to an enum to get a picker view?
(this doesn't work btw) :
enum…

Halpo
- 2,982
- 3
- 25
- 54
1
vote
0 answers
ARView rotation animation changes when coming back to it from a navigationLink
I have an app that uses RealityKit and ARKit, which includes some capturing features (to capture and image with added Entities). I have a navigationLink that allows the user to see the gallery of the images he has taken.
When launching the App, the…

David Koch
- 11
- 3
1
vote
1 answer
SwiftUI NavigationDestination appends View so it is before the current active View
In the code below when i press on a NavigationLink to go to a HeroView, I get an unexpected result. The view is temporarily added and then removed. When i go back from the HeroList to go to ContentView, it navigates to the HeroView i expected to…

IamActuallyIronMan
- 75
- 7
1
vote
0 answers
visionOS weird behaviour on NavigationStack title
I have a very simple navigation architecture so far, I left inner views (CourseDetail and CourseRows) as clean as possible to make sure there's nothing inside provoking the issue. Here's how it looks like.-
NavigationStack {
…

ssantos
- 16,001
- 7
- 50
- 70
1
vote
1 answer
SwiftUI NavigationStack "Back" Localization
I'm facing some problems with a SwiftUI NavigationStack and the "Back"-button that appears automatically in the upper left corner of the screen.
Even in a very simple application the Localization of this string only works if a Localizable.strings…

PDPS
- 31
- 3
1
vote
1 answer
SwiftUI NavigationStack: Unexpected Navigation Behavior from List View
I'm building an iOS app with SwiftUI and am encountering unexpected behaviour when navigating from a List view to a detail view.
I have three views: ViewA, ViewB, and ViewC. ViewA navigates to ViewB, which is a list of Item instances. Tapping on an…

Ci Leong
- 92
- 11
1
vote
0 answers
Deleting Object from EditView and Popping back to Root
Below is a simple representation of what I am trying to achieve in my own (much larger) application. This example has 3 Views:
ItemsView - displaying [Item]
DetailView - The selected Item with an option to edit the Item
EditView - Edit the selected…

OxfordSi
- 199
- 1
- 3
- 14
1
vote
0 answers
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
let name: String
}
struct ClientsListView:…

hitrain
- 133
- 8
1
vote
0 answers
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 this? In my use case I use a tab view, so I would…

Nicolas Gimelli
- 695
- 7
- 19
1
vote
1 answer
SwfitUI: Use .blur cause navigation title overlap with safe area
I want to blur the app when it's in the background so I have this in my TestApp.swift
import SwiftUI
@main
struct TestApp: App {
@Environment(\.scenePhase) var scenePhase
var body: some Scene {
WindowGroup {
…

Doraemoe
- 129
- 2
- 11