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.

198 questions
0
votes
3 answers

How to add space between NavigationStack elements and NavigationStack toolbar

What: add space between the list inside a Navigation Stack and the toolbar on top. Current code is like this struct ContentView: View { let words = ["Hello", "World", "SwiftUI", "OpenAI", "ChatGPT"] var body: some View { …
thenakulchawla
  • 5,024
  • 7
  • 30
  • 42
0
votes
1 answer

Use NavigationPath across multiple views in SwiftUI

I'm new to Swift/SwiftUI, and I'm working with the NavigationStack view the programmatic way using a NavigationPath. Here is a part of my code: struct ContentView: View { @State private var path = NavigationPath() var body: some…
Giesburts
  • 6,879
  • 15
  • 48
  • 85
0
votes
1 answer

Remove background from NavigationStack in SwiftUI

In my app, I want to construct a single background view under my NavigationStack and then show that same background underneath other views that I navigate to via NavigationLinks. I am trying to do this by putting the NavigationStack and my…
0
votes
1 answer

Share ViewModel only across specific views in NavigationStack

I have a NavigationStack with three forms inside it and each form has a couple of screens. How can I share a form's ViewModel only across its screens without having to create an instance globally( inside ContentView). Currently each ViewModel is…
peeta
  • 46
  • 3
0
votes
1 answer

Dismiss all the NavigationLink View to go back to Starting View from the third View

This is a simple code that I am trying to test for my required feature. I want to be able to click on the button or something to take me back to the FirstView without me needing to click the back button each time. I found that if I add another…
0
votes
1 answer

SwiftUI nested navigationDestination causes multiple init of @StateObject

I am building a navigation system based on NavigationStack and modifiers .navigationDestination(). What I am trying to achieve: I need to build a View hierarchy with navigation: - ContentView - ViewA.navigationDestination() -…
FunnyHorse
  • 33
  • 1
  • 6
0
votes
1 answer

Can ScrollViews and NavigationStacks work together in SwiftUI?

I've started to develop on SwiftUI very recently (hence the simple question), so as an exercise to work with layouts, I'm trying to recreate Apple's own Music app. The main issue I'm facing is NavigationStack and lack of resources about it…
Xabi Linazasoro
  • 59
  • 2
  • 13
0
votes
0 answers

SwiftUI4.0 NavigationStack(path: $pathList) + CustomNavigationBar How can I manage PathList when doing swipe back?

When using NavigationStack and CustomNavigationBar together, I don't know how to manage PathList for Swipeback action. Do you know anything? public func navigationController( _navigationController: UINavigationController, willShow_:…
Eggsy
  • 11
  • 5
0
votes
0 answers

Error with FullScreenCover in SwiftUI: A new orientation transaction token is being requested while a valid one already exists

I'm encountering an error when using the fullScreenCover modifier in SwiftUI. The error message states: "A new orientation transaction token is being requested while a valid one already exists." The error occurs during a fullscreen transition when…
0
votes
0 answers

Transition from inline to large navigationBarTitleDisplayMode is not smooth

The transition from the "detail view" which has inline title style to the "main view" which has large title style is not smooth. When I navigate from "detail view" the title style stays inline. This works good when the list is long and I am in the…
albstr
  • 9
  • 5
0
votes
1 answer

SwiftUI | Strange behaviour after appending paths to Routerpath onAppear

I want to completely rework how NavigationBar's look and rework back button as I like and have my own router In my app. I created this sample project to understand how NavigationStack and NavigationPath works before starting my project (From this…
0
votes
0 answers

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 { NavigationSplitView { List(1...20, id: \.self,…
0
votes
1 answer

NavigationView doesn't update when @State changes (NavigationStack works well)

I encountered this situation when trying to replace my NavigationStack (iOS 16+) by a NavigationView (for backward compatibility reasons). What I hoped for would be that NavigationStack and NavigationView would have similar behavior since Swift UI…
0
votes
0 answers

NavigationStack and NavigationDestination, using NavigationPath Correctly passing data

I am trying to pass data from one View to another using @StateObject navigating using NavigationStack and NavigationPath. In my case I can't use NavigationLink. To achieve that a came up with this code: struct ContentView: View { @State…
Sebastian
  • 6,154
  • 5
  • 33
  • 51
0
votes
1 answer

NavigationLink does not append to path inside NavigationSplitView/NavigationStack

The following code shows that $path is always 0, despite tapping a NavigationLink inside the stack. That means that when I select a panel, and tap on the navigation link to go to 'firstPanel subview', then select a new panel, it does not reset the…