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
0 votes
1 answer
28 views

SwiftUI navigating to child view with searchable retracted causes out-of-bounds view, app unresponsive

I have a SwiftUI NavigationStack which goes 3 levels deep. In the level 2, I have a .searchable modifier. When pushing to level 3 while the search bar is retracted up (awaiting user to type) the level ...
Petr Smejkal's user avatar
0 votes
2 answers
47 views

navigation is happening 2 times only

I have code as below. import SwiftUI struct ContentView: View { var body: some View { TabView { NavigationStack { NavigationLink("...
Fahim Parkar's user avatar
  • 31.3k
0 votes
0 answers
23 views

iOS 17 - SwiftUI push navigation animations start breaking

My code works well till iOS 16. But Push Navigations start breaking on iOS 17. The line delegate = self breaks my push navigation animations. (giving jerk instead of smooth right to left animation) ...
Aaban Tariq Murtaza's user avatar
0 votes
1 answer
41 views

Toolbar Items not working due to smaller screen size

I have five ToolbarItems set to appear in the topBarTrailing position. When the app is run on smaller devices or when the text size of the device is increased, 2/3 toolbar items combine into a menu ...
Muhammad Bilal's user avatar
0 votes
1 answer
41 views

NavigationStack causing view to reappear before going to another view

What i want to do 1. HomeView -> DetailView 2. HomeView -> PopularMoviesView -> DetailView The first happens with no issue but while doing the second homeview to popularMoviesView is okay but ...
Hemanth's user avatar
0 votes
1 answer
68 views

NavigationStack crashes when changing path in iOS 17.1.2

In my SwiftUI app I'm using NavigationStack with navigationDestination modifier to navigate user between views. In my AppState I'm holding a state for array of NavigationPath that are triggering state ...
armando's user avatar
0 votes
1 answer
32 views

SwiftUI: .navigationTitle showing on Preview, but not on Simulator

As the title says: the nav title shows on the previews (for all pages I've tried it on), but when I open up the simulator, it is not there. I tried it both with navtitle and also with the toolbar with ...
redwolfG's user avatar
0 votes
0 answers
27 views

iOS: NavigationStack.navigationDestination breaks ARKit Session used in RealityKit ARView

The following code is described as doing (this is related to Reality Kit ARView, although I am accessing the underlying ARKit Session as you will see): App opens to a .nonAR ARView FirstARView This ...
Marcus Raty's user avatar
0 votes
1 answer
162 views

NavigationLink inside TabView stops working

I have a view (NewGameView) with a NavigationLink to a different view (LoadView). In this second one there is a Button that closes the view, going back to the first one. This works wonderfully, until ...
coni garcia's user avatar
0 votes
1 answer
257 views

Change NavigationStack title font, tint, and background in SwiftUI

I am updating the UI of an iOS app, now targeting iOS 16 and above. In the previous version of the design I was changing the .navigationTitle font, style, and colour using something like this code: ...
markb's user avatar
  • 1,206
0 votes
1 answer
76 views

SwiftUI - How can I set individual customized toolbars/TopBars for each tabItem in a TabView when navigating from another View?

Scenario: I have a login screen with a "Enter button", as the picture shown below: Login Screen. The code, in its simplest form, is: NavigationStack{ // Contains BG and rest of ...
user3240549's user avatar
0 votes
0 answers
36 views

NavigationSplitView seems to draw where it should not

I have an application where I need to have a pane on the left of an iPad always visible. To the right of it I would like to have a NavigationSplitView. I'm new to NavigationSplitView, so this is ...
Andrew Voelkel's user avatar
0 votes
1 answer
79 views

ToolbarColorScheme change when back to previous screen programmatically using NavigationStack

I'm using navigationStack and I found that when I back programmatically using navigationPath instead of using default back button on navigation bar. My ToolbarColorScheme is change from dark to white. ...
TienTranMinh's user avatar
0 votes
1 answer
119 views

How to navigate from a sheet to a full screen

I am trying to use a navigation link within a sheet, however whenever I do it, I navigate within the sheet itself instead of a new full view. Sheet Picture: Navigation Picture: My current code looks ...
Pratyay Bishnupuri's user avatar
0 votes
0 answers
46 views

Navigation in SwiftUI

I am new in ios development and have an issue with navigation thing. I am making 15 puzzle app. From main menu (ContentView) i need to start save game, random game and get to list of saved games. Save ...
alex's user avatar
  • 11
0 votes
1 answer
241 views

The NavigationStack doesn't work inside Ornament in visionOS

I want to implement navigation in the left ornament, but I have an issue. The NavigationStack is not working there. It broke something in the app itself. The app structure looks like this: The first ...
Kanstantsin Bucha's user avatar
0 votes
0 answers
55 views

NavigationStackView .searchable modifier not visible when embedded in NavigationSplitView

can’t figure out why a NavigationStack with a .searchable modifier isn’t showing a search bar when embedded into a NavigationSplitView. Here’s how I’m showing the Navigation on the homescreen for ...
Ronni's user avatar
  • 55
0 votes
1 answer
92 views

How can I use value-based navigation inside a second view?

Here is a simplified reconstruction of my issue. I want my value-based navigation to work inside View2. How can I properly navigate from View2 to View3? Currently, View3 is being pushed onto the Stack,...
xen555's user avatar
  • 21
0 votes
0 answers
49 views

NavigationLink pops automatically to destination showing an emptyView and Back button to return to main NavigationView onAppear

I have a NavigationView on a view, once I load the view, I don't see my NavigationView until I hit the back button. It's a known issue issue with NavigationView, which is deprecated now, but I didn't ...
user6757933's user avatar
0 votes
0 answers
169 views

What is the professional way of using navigationDestination in a SwiftUI app that has multiple tabs and complex navigation?

I want to build an application that has different tabs and each tab has access to multiple views. Currently, this is how I handle it. I have created a singleton class that has all the information for ...
Kia Abdi's user avatar
0 votes
0 answers
44 views

Xcode: EXC_BAD_INSTRUCTION (SIGILL) using NavigationStack

If you put path in a class, Xcode crashes (previews for ContentView do not work). At the same time, it works fine in the simulator and on a real device. However, if the path is declared locally, then ...
Анатолий's user avatar
0 votes
0 answers
39 views

navigationTitle not showing up when navigating from target view

I have three views in my SwiftUI project. I navigate through these views as such: LoginView > TabMenuView > TemplateView. In TemplateView, the .navigationTitle and .toolbar does not show up when ...
BillNyes's user avatar
0 votes
0 answers
24 views

NavigationStack - returning to root view

I am developing (and maintaining) a SwiftUI based macOS app. Recently I have implemented navigation by NavigationStack. This is an alternative to other navigations and is selectable by user.. My ...
Tevensen's user avatar
0 votes
1 answer
246 views

How to figure out what navigationpath you came from to append to it?

I have several navigation paths using the same enum so that I'm able to clear that path and bring the user back to the main tab view for that item. This works great when I am using navigationLink(...
amelia's user avatar
  • 91
0 votes
0 answers
154 views

How can I properly add multiple NavigationStack's to the many detail View's of my main NavigationSplitView

I am trying to add NavigationStack's to the detail View's of my main NavigationSplitView. I have seen simplistic examples of how to achieve this with static lists that don't require any information ...
alionthego's user avatar
  • 9,179
0 votes
0 answers
33 views

Applying Corner Radius to NavigationStack: Restricted Interaction Areas

I tried to set a cornerRadius for the NavigationStack, but it caused the touch area to be limited to the original view position. To put it simply, when the slider is closed, tapping it won't open it. ...
Amirca's user avatar
  • 263
0 votes
0 answers
78 views

NavigationStack - NavigationPath Issue: View will not push when triggered from Detail View ( iOS17 )

I am trying to convert my project to the new NavigationStack in Xcode 15 and am having an issue push a new view from a detailed view. I have a Student List View (stdntListView) that passes the Student'...
SamCodes's user avatar
0 votes
0 answers
173 views

Swift UI navigation Stack - infinite loop

I am loading a page inside NavigationStack as given below, @State private var showLoginView = false var body: some View { NavigationStack { content() .navigationDestination(...
Easy Coder's user avatar
0 votes
1 answer
49 views

Passing binding through Navigation Link crashes the app

Here is the navigation stack All recipes > specific recipe > ingredients > specific ingredient All recipes View struct RecipesScreen: View { @EnvironmentObject var sessionData: ...
Fiona Kate's user avatar
0 votes
0 answers
98 views

Adding .navigationTitle to view in NavigationStack is breaking animation

I'm trying to create a view that shows a list of items / overview in one state and a detail for a selected list item in another state, and I'd like to show a hero animation when switching between ...
rizz's user avatar
  • 11
0 votes
0 answers
245 views

SwiftUI NavigationStack doesn't expand to fit parent when parent changes size

I am using navigation stack to navigate around a sheet, that changes size to match the content. When the sheet content changes size, the navigation stack is not resizing itself to match the new size ...
Angus's user avatar
  • 143
0 votes
0 answers
176 views

A navigationDestination was declared earlier on the stack

how to fix this error on the console: A navigationDestination for “Cost_Control.Movement” was declared earlier on the stack. Only the destination declared closest to the root view of the stack will ...
Damiano Miazzi's user avatar
0 votes
1 answer
60 views

Switch Tabs in SwiftUI on selective NavigationLink/NavigationDestination

I have a List of UI Components with NavigationLink. and .navigationDestination modifier. When NavigationLink is tapped, I want to open navigationDestination view only in some of the cases. in other ...
Pawan Joshi's user avatar
  • 1,569
0 votes
1 answer
325 views

Swiftui Menu with NavigationLink using an overall NavigationStack

I've read all previous posts on this topic but none seem to address what I'm seeing for iOS 16 and using NavigationStack. I'm also using an overall @EnvironmentObject for navigation state. I have a ...
Janene Pappas's user avatar
0 votes
0 answers
102 views

SwiftUI: Using FocusState in NavigationView doesn't dismiss the keyboard properly

While implementing a SwiftUI only application I'm using NavigationView for iOS 15 / NavigationStack for iOS 16, Keyboard doesn't dismiss properly under different conditions When using NavigationView +...
Vortex's user avatar
  • 11
0 votes
1 answer
729 views

In SwiftUI how do I push a DetailView in a NavView when adding a new item to a List?

It seems so weird that I couldn't find anything. Isn't this a common problem? So, I have a list in a NavigationView/-Stack and have a .toolbar add button. When tapping that button it should open a ...
Emily Axford's user avatar
0 votes
2 answers
51 views

SwiftUI - How to programatically load a new view from the current view

My App requires an initial view to be loaded programatically and not via the TabView. Here is an MRE to show the problem. The sequence is: ContentView loads the TabMenu The initial TabMenu View is ...
Edward Hasted's user avatar
0 votes
0 answers
39 views

Programmatic selection of list item using the new navigationDestination API

I was wondering if anybody could help with achieving the following using the new navigationDestination API. Currently, I am creating a CoreData entity within a child view (AddEventsView) and then ...
Alex Capaldo's user avatar
0 votes
0 answers
51 views

How to change destination on condition?

I am currently refactoring my navigation system from NavigationView to the new NavigationStack and I have a view in which if the user presses a button and has a certain device (i.e iPhone SE) then it ...
younes alaoui's user avatar
0 votes
2 answers
184 views

SwiftUI PhotosPicker - AXRuntimeError and detached view controller warning

I have the following code in a View that I show via a NavigationStack path.push() statement: @State private var avatarItem: PhotosPickerItem? @State private var avatarImage: Image? var body: some ...
Janene Pappas's user avatar
0 votes
0 answers
259 views

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 ...
Reality Business's user avatar
0 votes
0 answers
28 views

Swift navigate back to root [duplicate]

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(....
Cruder's user avatar
  • 39
0 votes
0 answers
39 views

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 ...
CarlosAndres's user avatar
0 votes
0 answers
19 views

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 ...
Adam's user avatar
  • 2,268
0 votes
0 answers
20 views

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 ...
Y4nn's user avatar
  • 1
0 votes
0 answers
130 views

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 ...
ProtonFission's user avatar
0 votes
0 answers
524 views

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 ...
san's user avatar
  • 31
0 votes
1 answer
80 views

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 ...
Emet Amil's user avatar
0 votes
0 answers
152 views

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 ...
Reality Business's user avatar
0 votes
0 answers
57 views

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 ...
TheDoctor's user avatar