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.
154
questions with no upvoted or accepted answers
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 ...
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 ...
6
votes
0
answers
258
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
...
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 ...
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
...
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
...
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 ...
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 ...
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 ...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 {
...
3
votes
0
answers
284
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 ...
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: ...
2
votes
0
answers
106
views
Programmatic Routing in SwiftUI for TabView
I'm working on a SwiftUI application that follows a navigation pattern similar to Instagram, with a TabView at the root and complex navigation paths starting from different tabs. I've set up my ...
2
votes
2
answers
490
views
SwiftData - using @Query with a filter predicate does not work as expected
I am using SwiftData & SwiftUI. This is the rough setup of my code:
struct ListItemView: View {
@Environment(\.modelContext) var modelContext
@Query
private var items: [Items]
@...
2
votes
1
answer
198
views
Replace top view in NavigationStack
I have a fairly complex app that uses NavigationStack with several navigationDestinations. Things were working well until I got a request to have a button which replaces the current view with a new ...
2
votes
0
answers
237
views
Persist navigation paths in NavigationSplitView with NavigationStacks
I have an SwiftUI iOS app that uses TabView to display 4 different NavigationStacks. Each stack can be navigated into.
To make this app work better on iPad OS I'd like to use a NavigationSplitView ...
2
votes
1
answer
180
views
In SwiftUI showing an AdMob Interstitial breaks NavigationLink objects - what am I doing wrong?
I have a simple app with a Home View, a Content View and a Settings View. I am trying to show an AdMob Interstitial when I navigate from the Home View to the Content View. The navigation between views ...
2
votes
1
answer
284
views
Change NavigationStack-path from ViewModel?
I'm trying to implement the MVVM-architecture in my little app and I am confused about how to update the path of my NavigationStack from the ViewModel. My path is a @Published property and gets ...
2
votes
0
answers
414
views
NavigationStack push animation disappears after presenting a view with .sheet modifier
I need to present a view with .sheet modifier in NavigationStack. But the default push animation of NavigationStack will disappear if I present a view with .sheet modifier first. This is my code:
...
2
votes
0
answers
369
views
NavigationSplitView detail not updating
Why does the button "Show second view" not work here?
struct ContentView: View {
@State private var showSecondView = false
var body: some View {
NavigationSplitView {
...
2
votes
0
answers
645
views
SwiftUI - NavigationStack: Why my NavigationPath() is printing the wrong path.count?
I have the following basic utilization of NavigationStack with SwiftUI for iOS 16, Xcode.
The issues I am facing is that when I click back and printing the count, the root count is wrong and shows as &...
2
votes
0
answers
866
views
Use NavigationStack + NavigationLink + .navigationDestination without Hashable conformation
Consider the following code,
import SwiftUI
class Product: Identifiable {
let id = UUID()
let title: String
init(title: String) {
self.title = title
}
}
struct ContentView: ...
2
votes
0
answers
192
views
NavigationLink In NavigationStack is disabled
I wrote test code for NavigationStack. The behavior of the code is a two-step transition(ContentView -> SubsubTestView -> DetailView).
But I got an error when I have selected a name in ...
2
votes
0
answers
306
views
Removing more than one view from NavigationStack is not animated
I noticed that removing more than 1 view from a NavigationStack (using .removeLast(k) on its NavigationPath, where k > 1) is not animated at all. I was expecting to see the previous view sliding ...
2
votes
1
answer
1k
views
SwiftUI Navigation Stack with Routes
I'm trying to create navigation for my app using Navigation Stack and routing.
My code is functioning and navigating to views, the problem I'm having is that the view is getting called several times ...
2
votes
1
answer
273
views
SearchBar leads to warning. SwiftUI
I noticed that Xcode shows warning when a view has list with SearchBar and swipe down action leads to it.
The warning message: [Assert] What changed the navigation bar bounds size to something ...
1
vote
0
answers
74
views
How to properly manage view focus while pushing multiple views to NavigationStack path in SwiftUI iOS 17+
I'm trying to save the state of my NavigationPath for my NavigationStack in SwiftUI by pushing all the views to the stack at once. That way if the user taps the Back button, they will still see the ...
1
vote
1
answer
140
views
SwiftUI navigation link infinite loop causes app to freeze
I have the following SwiftUI set up
In my main, I have something like this
// singleton
@StateObject var authStatusManager = Factory.shared.authStatusManager
var body: some Scene {
WindowGroup {
...
1
vote
0
answers
188
views
How to use navigation paths when views are the same across tabs?
I have a tab view at the highest level, and right now, only one view has a navigation path cause I am working on adding the others, but I've run into a blocker first. I was planning for each tab view ...
1
vote
0
answers
198
views
Divider() not shown as it should be with SwiftUI
I want to make a divider in white with some opacity (under the navigation view) but for a reason I don't know the Divider() isn't shown as it should be.
Here's a screenshot of the design:
And here's ...
1
vote
0
answers
154
views
TabView Inside of NavigationStack has extra inset when ignoring Safe Area
I am using the following code to setup a TabView with a paging style inside of a NavigationStack
struct ContentView: View {
var body: some View {
NavigationStack() {
TabView {
...
1
vote
0
answers
240
views
How to fix Update NavigationAuthority bound path tried to update multiple times per frame
For navigation I am using the iOS 16 NavigationStack API. I keep my NavigationPath instance inside my view models as @Published instead of in the views with @State. When navigating between the ...
1
vote
0
answers
97
views
SwiftUI, prevent the subview to inherit parent's animation
I've been playing with the NavigationPath for some time. I first figured that when a view is inserted into the path (full code is on this answer), the inserted page doesn't have standard navigation ...
1
vote
1
answer
2k
views
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:
...
1
vote
1
answer
156
views
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()) {
...
1
vote
0
answers
136
views
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 ...
1
vote
0
answers
625
views
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.&...
1
vote
0
answers
38
views
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 ...
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 {
...
1
vote
0
answers
228
views
use navigationDestination(isPresented: ) and .navigationDestination(for: data) together
I come across a strange navigation bug, this is my code:
import SwiftUI
struct TestNavView: View {
@State var isPresented = false
var body: some View {
NavigationStack{
...
1
vote
0
answers
198
views
SwiftUI hanging with @Environment and NavigationStack when passing Bindings
I've got a NavigationStack and I'm passing bindings to multiple children through a couple of different views. If I don't pass the children as bindings then everything works as intended. Also if I ...
1
vote
0
answers
823
views
SwiftUI] access multiple NavigationStack
I use TabView & NavigationStack. TabView covered NavigationStack & inner View also covered NavigationStack. I want an inner navigation Push but it's always the root Navigation Push (in ...
1
vote
0
answers
204
views
Why is my navigation path not appending the model the further I go in?
I've implemented a navigation stack that appends the next view's view model so that the appending and .navigationDestination looks like the below. Whenever I press the continue button to add the ...
1
vote
1
answer
849
views
How to call Task in NavigationLink destination in SwiftUI?
I've created a list using LazyVStack and inside of the list there are ListItemViews.
What I'm trying to do is, when a ListItemView gets tapped, I want to make an async call depending on the selected ...