Questions tagged [swiftui-navigationview]

For questions about NavigationView - a view in Apple's SwiftUI framework that presents a stack of views representing a visible path in a navigation hierarchy. When using this tag also include the more generic [swiftui] tag where possible.

Links:

583 questions
2
votes
1 answer

SwiftUI3 navigation link doesn't work after pop if stack size > 1

SwiftUI 3 navigation link doesn't work after pop if stack size > 1 Steps to reproduce: Launch the app Tap any row in list #1 Tap any row in list #2 Tap Back Tap any row in list #2 Result: nothing happens, navigation link doesn't work Expected…
Nik
  • 9,063
  • 7
  • 66
  • 81
2
votes
0 answers

Swift - Preserve selected item in navigation view when moving around items

I'm building a macOS swiftUI app with a sidebar navigationView that determines what displays on the right of the screen. The user is able to move around the items in the sidebar. However when an item is dragged to a new location, the selection in…
2
votes
0 answers

NavigationView inside TabView going to next page by default

I am wrapping my navigaton view inside a tab view. but when I load the app, my navigation view is always going to its next page by default. How can I stop this ? I spent so much time but could not figure it out. here is my view ZStack { …
2
votes
1 answer

Navigating to a SwiftUI view from a button pressed in a UIViewControllerRepresentable

I am using a Swiftui list to show tasks. Each task has a location. When you click on the list row I am using a NavigationLink to navigate to a details page. I am using a UIViewControllerRepresentable that creates a map view with all the task…
2
votes
1 answer

Overlay on top of inline navbar

Is it possible to overlay something on top of an inline nav bar? Here's an example with a popup where you can display and alert and then tap outside the alert to dismiss it. I'd like the dark background overlay to also cover the nav bar. This works…
sia
  • 256
  • 3
  • 14
2
votes
2 answers

SwiftUI @State variables aren't updated

I basically have the same code as in this question. The problem I have is that when the tapGesture event happens, the sheet shows (the sheet code is called) but debug shows that showUserEditor is false (in that case, how is the sheet showing...?)…
Aviad Ben Dov
  • 6,351
  • 2
  • 34
  • 45
2
votes
0 answers

Stack Navigation View Style in Swift UI iOS 14.5 bottom bar sticking on view dismissal

So I have a Navigation View in SwiftUI and when I use Stack Navigation View Style, I have 2 views: the root Navigation View, then the navigationLink in which the view has a bottom toolbar, and when I dismiss this view and go back to the root view,…
2
votes
1 answer

Can a NavigationLink perform an async function when navigating to another view?

I'm trying to create a navigation link in SwiftUI that logs in a user and navigates to the next screen. I've tried using .simultaneousGesture as shown below, based on this solution. When I have it perform a simple action (e.g. print("hello")), the…
sia
  • 256
  • 3
  • 14
2
votes
3 answers

How to remove a searchbar from NavigationView in SwiftUI?

I followed this tutorial to add a SearchBar on my SwiftUI app: http://blog.eppz.eu/swiftui-search-bar-in-the-navigation-bar/ It basically uses a custom modifier to add the SearchBar into NavigationView: extension View { func add(_…
Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165
2
votes
1 answer

Move to nextView on button click based on condition, swiftUI

I've read a lot here about navigation in SwiftUI and tried a couple of things, but nothing is working as desired. I am developing a watch app in which I have to use two TextField. I only want to move on next screen when both field are not empty.…
2
votes
3 answers

SwiftUI - Inconsistent list item widths

I have a curious situation. I have two lists that both use ForEach to iterate over several ListItem structs. In the first view, the ListItems seem to go out closer to the horizontal edges than in the second view. Both use similar code like this: …
2
votes
1 answer

SwiftUI - menu not appearing and double toolbar for NavigationView

I am creating a iOS app with XCode. All source code has been written and compiled. The app runs in the iOS simulator. The user interface was created in SwiftUI and it appears as expected. The navigation seems to be working across the screens but I…
P5music
  • 3,197
  • 2
  • 32
  • 81
2
votes
1 answer

SwiftUI navigate back to upper but not root view

I have four pages like so: Page 1 Page 2 Page 3 Page 4 where I navigate between pages based on a state boolean. I am looking to navigate from Page 4 back to Page 2 on the click of a button on page 4. This is what I have: import SwiftUI struct…
David
  • 732
  • 1
  • 6
  • 15
2
votes
1 answer

Updating SwiftUI navigation bar title

I have a Form view that sets the navigation bar title to "Settings" and a Picker view inside the Form view that sets the navigation bar title to "Options". When navigating to Picker view, the navigation bar title does not get set to "Options", but…
Alex
  • 739
  • 1
  • 6
  • 18
2
votes
0 answers

SwiftUI: How to detect navigation up or down

I have following SwiftUI code, which makes a connection (to the server) when the user navigates to this page (this is a part of navigation stack), and disconnects when the user navigate away (up). struct ServiceView: View { @ObservedObject var…