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
0 answers
24 views

Detail view not fitting its container when hiding/showing sidebar in NavigationSplitView

I have something like this: NavigationSplitView(columnVisibility: $fetcher.columnVisibility) { SideBar() } detail: { Content() .onAppear { if isVision { fetcher....
ssantos's user avatar
  • 16.3k
0 votes
1 answer
30 views

navigation inside custom framework made with swiftui

I am creating a custom framework in SwiftUI that will have navigation between screens. The application implementing it will have navigation too, how can i avoid duplicate navigation scenario in the ...
muzzammil's user avatar
0 votes
1 answer
33 views

Text() and .navigationBarTitle() have different left margin

In this code, Text("Text 2") has a smaller margin to the left side of the screen than .navigationBarTitle("Text 1"). It's on iPhone 15 Pro Max. How can I align the left margin for ...
Dmitriy's user avatar
0 votes
1 answer
41 views

Why bottom toolbar items placement is changing when i apply toolbar color scheme modifier in SwiftUI?

So when there is more than 2 toolbar items the default item placement is all the items (ToolbarItem) in the hierarchy to the left and the last item (ToolbarItem) in the hierarchy to the right. After i ...
Rehan Ali Khan's user avatar
1 vote
1 answer
96 views
+50

How to pass data to a sub View from a SwiftData query

I'm learning Swift through a project. I'm creating an app where the user can create multiple accounts and register transactions within each account. The models and views that are relevant to my ...
bluprince13's user avatar
  • 4,737
-1 votes
1 answer
49 views

Why does swift navigation list with button open a sheet multiple times instead of just once?

TLDR: In the following code, clicking on the button from the top level ContentView opens multiple sheets, and then when closing the sheet it gets triggered again; yet clicking it from the RowView only ...
learnandgrow's user avatar
0 votes
0 answers
23 views

Custom TextField/Button: presents search view

I am trying to create a simple view but learning SwiftUI has been a challenge. Using SwiftUI I am trying to create a view that has a Textfield/Button combo, where when clicked it will present a ...
Yuda's user avatar
  • 45
0 votes
0 answers
26 views

Can I set the color of the back button conditionally, based on the View? [duplicate]

I've seen several questions about how to set the color of the Back button in a NavigationStack/NavigationView by using .accentColor or .tint. However, none of them address my issue. I have a HomeView....
phroureo's user avatar
  • 379
0 votes
1 answer
33 views

TabView child views don't support ToolbarItem and NavigationTitle

I have some issues with child views inside TabView. This is my parent view: var body: some View { NavigationStack { VStack(alignment: .leading) { TabView { ...
fedjedmedjed's user avatar
0 votes
1 answer
34 views

NavigationStack with .navigationDestination doesn't works for me

I'm new with SwiftUI and I have a problem with the navigation with NavigationStack and .navigationDestination(). When I press the button with the label: Ir a binding View, the navigation doesn't occur....
Marquez_32's user avatar
0 votes
0 answers
16 views

Weird Lag when offsetting Navigation Stack

I have really unwanted behavior with NavigationStack. When I try to offset the whole NavigationStack the NavigationTitle jumps like 10 pixels when offsetting it down Here is the code. It is really ...
Allleex's user avatar
  • 145
1 vote
2 answers
45 views

Button inside NavigationLink that's inside a list item not working correctly

I have a button that I would like to link to another view upon clicking on it. I was told to put it inside a NavigationLink, use .borderless button style, but it activates outside of its area on the ...
nore982's user avatar
  • 23
0 votes
0 answers
41 views

How to Prevent Black Stripe Appearance on Navigation Bar When Scrolling Up?

I'm currently developing an iOS app using SwiftUI and facing an issue with the navigation bar's behavior in a view wrapped in a NavigationStack. Specifically, when I scroll up the list, a black stripe ...
David Feldman's user avatar
0 votes
0 answers
40 views

Using NavigationLink(destination:, label:) and .navigationDestination in the same app breaks Navigation Stack

In an app I'm working on, NavigationStack is created at the App level with Screen 1 as the root. Screen 1 has a NavigationLink with destination and label parameters. On tapping the NavigationLink, the ...
Gowtham Ravichandran's user avatar
0 votes
0 answers
24 views

NavigationLink not storing the previous state in SwiftUI (for mobile app)

I need to implement the below scenario: When user is in mainPage view and types the input and clicks it, it calls the viewModel.selectItem function and that will in turn call the API from the backend ...
Usha's user avatar
  • 3
0 votes
1 answer
58 views

NavigationStack and TabView causes screen misalignment

We have installed a TabView in our NavigationStack and have encountered the following problem. Probrem1: After transitioning from FristPage() to NextPage(), the screen behaves as if it is shifted in ...
vivi's user avatar
  • 1
0 votes
1 answer
23 views

Re-using same code for navigationbar items in SwiftUI

I'm setting up an SwiftUI app with TabView-navigation and individual NavigationStacks (to preserve individual navigation state per stack). One thing that buggles my mind is that I want to have the ...
esbenr's user avatar
  • 1,426
0 votes
0 answers
23 views

Open NavigationLink from Local Notification in NavigationStack iOS17

The Notification provides the uuid corresponding to the Item saved in SwiftData. Goal is to open the correct DetailItem View when I tap the notification. How can I achieve this? @Model final class ...
Tezzus's user avatar
  • 11
0 votes
0 answers
47 views

Is it wise to have a single state as an environment object for the whole SwiftUI app?

I've been looking at different ways to build in deeplinking capabilities for a SwiftUI app using NavigationSatck. Some articles suggest having the navigation state injected as an environment object ...
Vaibhav Singh's user avatar
0 votes
0 answers
39 views

Map produces weird bottom inset in SwiftUI 15

When I tap to the MapView there is this weird inset which looks like a tabBar. Also when I tap around in the my custom tabBar sometimes you can see the default Apple tabBar for the split of a few ...
Toni's user avatar
  • 13
0 votes
1 answer
52 views

Returning to 'Home' View with NavigationStack

I'm trying to navigate to my 'home' view when the user clicks a button a few screens into the NavigationStack. My skeleton code is below and I can't figure out why it doesn't return to View1 after ...
Hulkasaurus's user avatar
0 votes
1 answer
74 views

Why programmatic navigation of NavigationStack inside a NavigationSplitView doesn't work without a delay?

Here is the simplified version of my app, consisting of NavigationSplitView with NavigationStack as its detail view. The programmatic navigation I use here works because I delay assignment of the ...
Yury Kaspiarovich's user avatar
0 votes
1 answer
43 views

Inconsistent spacing between navigation bar toolbar items in SwiftUI

I have 2 trailing navigation bar buttons called Draw and Save. On tapping Draw, I want 2 additional toolbar buttons to be added to the navigation bar. This is how I am adding my nav bar buttons: var ...
Shawn Frank's user avatar
  • 4,781
0 votes
0 answers
31 views

SwiftUI Navigation

i'm facing some issues with my clone app. now i'm trying to create a clone messenger app. the problem is when user successful log in to the app, the main screen didn't show up as i expected how it ...
viet anh nguyen's user avatar
-1 votes
1 answer
44 views

NavigationStack and binding to a selection

I'm developing a watch app similar to Apple's demo workout app, but as of watchOS9 NavigationView has moved to NavigationStack. In the demo, a list of workouts are presented; when a workout is ...
Theo Carper's user avatar
0 votes
2 answers
30 views

NavigationStack - Pushing root View twice not working

Perhaps I am not understanding NavigationStack well and hope someone can help me. I've setup a small example to demonstrate the issue: @main struct StacksApp: App { var body: some Scene { ...
Robert J. Clegg's user avatar
-3 votes
1 answer
70 views

NavigationPath(_items: SwiftUI.NavigationPath.(unknown context at $7ff84b690a28) Representation.eager([SwiftUI.(unknown context at $7ff84b6907f0).C

I tried to use navigationstack, and it works. but couldn't print the path, and with the message: " NavigationPath(_items: SwiftUI.NavigationPath.(unknown context at $7ff84b690a28).Representation....
xj zhang's user avatar
0 votes
2 answers
83 views

Are there any way to work using NavigationStack with NavigationLink to support applications below iOS 16?

In some points of the code, I need to use this: NavigationLink( destination: LoginViewScreen(), isActive: $navToLogin ) { EmptyView() } ... because my navigation is not using ...
Joao Macedo Dev's user avatar
0 votes
0 answers
44 views

When push new view to NavigationPath using NavigationStack others views in stack also get called in SwiftUI

Why this happening, and any solution would be appreciate. I'm using Coordinator pattern where all views pushed in a central place. Coordinator class Coordinator: ObservableObject { @Published var ...
Shariif Islam's user avatar
1 vote
1 answer
36 views

Unwanted whitespace in Custom NavigationBar in SwiftUI

I have an unwanted white space in my custom SwiftUI NavigationBar, which I want gone. I played around with removing the paddings, but I don't get the wanted looks nor does that remove the white space. ...
Toni's user avatar
  • 13
0 votes
0 answers
50 views

SwiftUI Warning: Update NavigationAuthority bound path tried to update multiple times per frame

I have a warning “Update NavigationAuthority bound path tried to update multiple times per frame.” when I click “Add Item”. This warning doesn’t show after the elements are in the list. It only ...
Evgeniy Poznyak's user avatar
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
1 answer
29 views

Animation toolbarBackground visibility not works

I'm trying to set toolbarBackground visibile with animation, but it's happen immediatly. Are there ways to make this with animation? struct MyView: View { @State private var barHidden = true ...
Egor Hmara's user avatar
1 vote
2 answers
117 views

What is the solution to this NavigationStack glitch?

I've encountered a strange glitch with NavigationStack when mixing the old-style NavigationLink with the new .navigationDestination style ones. While this example is trivial and easily fixed here, in ...
trapper's user avatar
  • 11.8k
2 votes
1 answer
88 views

SwiftUI: NavigationPath always empty

The issue I'm facing is that my NavigationPath is always empty. The context is that I have 3 Views. View A contains the NavigationStack and has two NavigationLinks, to View B and View C respectively. ...
Patrick Ciurea'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
-1 votes
1 answer
71 views

NavigationLink takes me to the parent view of the view with the navigation stack on it

I am new to SwiftUI and I am simply experimenting with different NavigationStack options. I have a navigation stack that shows a list of words. When the user clicks on the navigation link it shows a ...
Toni78's user avatar
  • 97
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
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 ...
faizy's user avatar
  • 624
0 votes
1 answer
108 views

How to combine GroupBox or DisclosureGroup with a List in a SwiftUI NavigationStack

Ultimately, I am trying to replicate the layout used in Apple's Tips app: The app appears to have a NavigationStack that contains non-list items but that fit the overall list style. When I try to ...
cchana's user avatar
  • 4,921
1 vote
1 answer
126 views

NavigationStack does not display a view on UI after appending a new path

I am using SwiftUI NavigationStack as a router in my application. I have a ParentView as an initial view with a button. When I click a button I want to show a loading view and when API answer is ...
ofun's user avatar
  • 63
1 vote
1 answer
146 views

Shared toolbar items in SwiftUI NavigationStack

I have a navigation stack that's about three views deep. I want every single destination in this stack navigation to all have exactly the same toolbar items, a "Skip" button at the top right ...
barndog's user avatar
  • 7,052
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
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 ...
nickelx's user avatar
  • 11
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
1 vote
2 answers
117 views

How do I detect when I return to the root view of NavigationStack in SwiftUI?

How do I detect from the root view that I've returned back to the root view after navigating via NavigationLink to another view? .onAppear() is not triggering when I return back to the root view via ...
Matt's user avatar
  • 593
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
-2 votes
1 answer
78 views

Passing data through Navigationlink with custom views - SwiftUI

Im trying to pass two kinds of different JSON data in an app with two different views in two navigationlinks, what works One custom view which with the name LaundryList that gets passed in the ...
Jeria93's user avatar

1
2 3 4 5 6