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
3
votes
1 answer

Navigation Link leading to gray screen in Swift UI

I am new to SwiftUI and am having a bug where my entire screen turns gray when I use too many Navigation Links. I cannot find any solutions while researching the bug. I am running the project on the newest version of Xcode 12.4. My current setup is…
3
votes
1 answer

How to Push View or Present View Modally in SwiftUI dynamically?

I'm learning SwiftUI and my focus at the moment is to implement a method which I'm able to implement using UIKit. I need to create a method the determines whether I should Push the View or Present modally the view based on the value of a boolean. In…
3
votes
1 answer

How do you disable a navigationBaritems in swiftUI

I have a .navigationBarItems button that I want to enable/disable depending on what my app is doing but I cannot for the life of me figure out how the heck to do this?! My view is being pulled into my main app view via a NavigationView so I know the…
jammyman34
  • 1,399
  • 4
  • 15
  • 22
3
votes
1 answer

SwiftUI: How to smoothly transition bottomBar toolbar when navigating back?

I want to have a toolbar with placement .bottomBar in one of my views. When navigating away and coming back however, the toolbar doesn't transition smoothly with the rest of the view - it suddenly appears, shifting the whole contents of the view up,…
Daniel Elkington
  • 2,560
  • 6
  • 22
  • 35
3
votes
0 answers

NavigationLink Push via isActive gets dismissed immediately

I want to init a navigation stack in SwiftUI. Thus I want to push a second view immediately after a first view appears. Therefore I want to use a @State var, which I set to true onAppear, and thus activates a NavigationLink. However, the approach is…
3
votes
1 answer

Conditionally show Navigation View

Since only one NavigationView should be used in the view hierarchy, how do you deal with the case where the initial view to be presented is determined at app start? @main struct heartbreaksApp: App { let token =…
jesper
  • 55
  • 5
3
votes
2 answers

How to hide TabView when opening a new view with NavigationLink?

Assuming we have a SwiftUI view containing struct ContentView: View { var body: some View { TabView { FirstView().tabItem { // tabItem image and text } SecondView().tabItem { …
3
votes
0 answers

Using view models in SwiftUI without allocation overhead

Using View Models in SwiftUI For a clean separation of concerns, I want to use my SwiftUI views with view models. I have two views, a ListView and a DetailView where the first pushes the latter when any list item is tapped – a classic navigation…
2
votes
3 answers

SwiftUI: Detect NavigationView goes back to main view

I have a NavigationView and the following view structure ViewA -> ViewB -> ViewC and I'm trying to figure out how to detect when ViewB goes back to ViewAViewB -> ViewA. Here is my Code: struct ViewA: View { var body: some View { …
user2924482
  • 8,380
  • 23
  • 89
  • 173
2
votes
0 answers

NavigationStack to TabView

I've spent sometime going over questions on Stack Overflow and couldn't find an answer. I'm trying to navigate from a List View (similar to a Sidebar) to a View that contains a TabView. However, when I move to the TabView the Navigation Title and…
Pam
  • 121
  • 3
2
votes
1 answer

SwiftUI navigation link screen pops when change color theme

I have a TabBar view with a single tab (for the demo purposes). The tab view screen has a NavigationLink button which sends you to a screen with a Text box only. The problem that occurs is that whenever I am on the second screen and change the color…
2
votes
1 answer

Apple-provided environment var `dismissSearch` not working

In this SwiftUI-based code, the dismissSearch, as specified here, does not work. That is, upon tapping "Search" on the keyboard, I expected the search bar to cancel, clear the search text field, and have the nav bar with the gear icon visible. As…
fingia
  • 504
  • 7
  • 20
2
votes
0 answers

Show a view on top of a Sheet - SwiftUI

I want to show a Sheet, and then show a certain view (toast in my case) over all the NavigationView, including the Sheet, but it's showing behind the Sheet. This is my Toast ViewModifier: struct Toast: ViewModifier { //MARK: - PROPERTIES …
2
votes
1 answer

Is there any way to make NavigationSplitView's side bar with clear background?

I am trying to make side bar in NavigationSplitView with clear background for side bar, so that detail view is visible under sidebar when it is open.In UIKit it is possible to make, when iPhone in portrait mode. How can I make it in SwiftUI? In view…
2
votes
0 answers

SWIFTUI Tabview makes me long press after embedding in UiHostController, how do I stop this?

I am adding a SwiftUi view to my story board via UIHostController. The integration works and I have full functionality of buttons and image taps, however the Tabview at the bottom of the screen requires a long press in order for the Tabview to work…