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
743 views

How to dismiss a Sheet and open a NavigationLink in a new View?

I have a View with a search button in the toolbar. The search button presents a sheet to the user and when he clicks on a result I would like the sheet to be dismissed and a detailView to be opened ...
Abdo23's user avatar
  • 77
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
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
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
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
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
0 votes
1 answer
48 views

SwiftUI EnvironmentObject passing in @StateObject vs creating instance inline causes different behaviour

I am passing EnvironmentObjects at the app level so that I can access them throughout the app. I am creating them in line like so: var body: some Scene { WindowGroup { MainContentView() ...
Petr Smejkal's user avatar
0 votes
2 answers
114 views

SwiftUI NavigationStack always pops to root

I have recently updated the navigation in my app from using lots of NavigationLinks, because I was seeing errors surrounding multiple pushes to the navigation stack. My app is now working well with a ...
MarcusWilliams's user avatar
0 votes
1 answer
156 views

SwiftUI NavigationStack: Destination does not show up but shows same view again

In the following sample app, why after tapping on "Second Destination" does the same screen show up again instead of actually showing the SecondDestination? struct ContentView: View { ...
Isaak's user avatar
  • 1,239
0 votes
1 answer
40 views

My button is not navigating me back to my page

I am building a sign up page and when I click either the login button or the back button it is not taking me back to the login page. This is the variable: @Binding var showSignup: Bool Here is my ...
AppleDev3's user avatar
0 votes
1 answer
171 views

@Environment(\.dismiss) var dismiss popping to root instead of previous screen

I am working on a SwiftUI project that has a loginView (Root view embedded in NavigationStack). When I push to registration screen (Screen A) using .navigationDestination(...) modifier and then to ...
Nisar Ahmad's user avatar
0 votes
1 answer
257 views

How do you hide the NavBar in certain SwiftUI Views while also proving a Back button to go to the previous tab?

I am trying to recreate the NavBar behavior that a lot of fitness apps like Strava and AllTrails use to make the activity specific page less busy by removing the NavBar for that specific page. In ...
stackiee's user avatar
  • 309
0 votes
1 answer
41 views

SwiftUI - Force automatic title display mode in just one view

I have two views, both with their NavigationStack like this: First View Code: NavigationStack{ VStack{ NavigationLink{ SecondView() }label:{ \\some code here ...
helloimbrando's user avatar
0 votes
1 answer
354 views

Returning to root on a SwiftUI NavigationStack from another view

I'm having the hardest time figuring out NavigationStacks in SwiftUI. I have a MVP example below from Apple's documentation on NavigationStack. What I would like to do is have a button that would all ...
DannyK's user avatar
  • 115
0 votes
1 answer
1k views

View protocol - any vs. some vs AnyView vs. generics

I'm looking to create a protocol upon View to group views that can be constructed from some specific data struct (MyData) protocol EncodableView: View { /// Returns true if this view type can be ...
Haensl's user avatar
  • 415
0 votes
1 answer
354 views

Pop View from NavigationStack Animation Issue in SwiftUI

I was wondering about the issue with the manual popping animation when changing the path in NavigationStack. When backing from Subview1 to RootView, a white screen appears in the background during the ...
Amirca's user avatar
  • 263
0 votes
1 answer
235 views

Scale Animation and Safe Area with NavigationStack in SwiftUI

I'm trying to wrap a content view inside a NavigationStack. However, when I use NavigationStack, the scale animation shows strange behavior and it does not ignore the safe area either (it works ...
Amirca's user avatar
  • 263
0 votes
1 answer
163 views

SwiftUI - Undo a backwards move in a NavigationStack

When I navigate backward (like swiping the view from the left), I want to be able to swipe it back from the right to move to that previous view. Sort of like an undo stack. Is it possible to use ...
roydbt's user avatar
  • 91
0 votes
1 answer
301 views

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 ...
Samuel Davies's user avatar
0 votes
3 answers
375 views

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", "...
thenakulchawla's user avatar
0 votes
1 answer
680 views

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 ...
Xabi Linazasoro's user avatar
0 votes
2 answers
863 views

NavigationStack with route switching. How to bring "value:" from the NavigationLink since already filled by the Route.link?

I'm using the new NavigationStack from SwiftUI. I'm using it with enum route switching. How can I bring a "value:" to the "destination" view from the NavigationLink just like I ...
Pro Girl's user avatar
  • 882
0 votes
1 answer
225 views

NavigationStack has correct colors, but NavigationLink does not?

I have this app that uses a NavigationStack to change the colors of the toolbar. When a navigation link is clicked, the navigation colors are not preserved onto the new screen and it goes back to ...
ToxicFlame427's user avatar
0 votes
1 answer
73 views

Why different cell animation when popping initial NavigationStack path item?

With this test app: import SwiftUI enum Route { case first case second } @main struct NavigatorApp : App { @State private var path: [Route] = [.first] var body: some Scene { ...
meaning-matters's user avatar
0 votes
1 answer
127 views

Replicate deprecated NavigationLink behaviour within a NavigationStack

I'm in the midst of moving my app from iOS 15 to iOS 16. In my app ( iOS 15 ) I have a LogOn View (sysPassView) that automatically pops on first entry into my Navigation View using the following code: ...
SamCodes's user avatar
0 votes
1 answer
151 views

Some NavigationLink are inaccessible

My SwiftUI TVOS app has two sets of NavigationLink. When both sets are present (not commented out), only one set is accessible to tap on. If I comment out one or the other set, the remaining ...
I'm Just a Bill's user avatar
0 votes
1 answer
396 views

Cannot pass value from one view to another(SwiftUI)

I want to take 2 numbers input in the textField and print the multiplication of the two numbers in the third view(ResultView). I have 3 views :- a - ContentView(This view contains the navigation ...
Uday Chaudhary's user avatar
0 votes
2 answers
483 views

How can i change the navigationTitle text color in a NavigationStack?

I tried this but not working : init() { let navBarAppearance = UINavigationBar.appearance() navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white] ...
Flincorp's user avatar
  • 871
0 votes
1 answer
240 views

new navigation stack swiftui 4

Hello I'm using the new navigation stack and I don't really understand how it works in a situation like mine. I have the first view (DashboardView) from there I have two navigationdestination(...
Nicola Rigoni's user avatar
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
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
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
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
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
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
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