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
4
votes
2 answers

SwiftUI Navigation View goes back in hierarchy

I have a problem with Navigation View hierarchy. All screens in my app use the same ViewModel. When a screen inside navigation link updates the ViewModel (here it is called DataManager), the navigation view automatically goes back to the first…
4
votes
3 answers

How to handle .onDelete for SwiftUI list array with .reversed()

I am attempting to make a basic SwiftUI list in which each new list item is presented at the top of the list. To do this, I appended .reversed() to the array passed into the ForEach loop, represented by viewModel.itemList. I have also set up…
JS_is_awesome18
  • 1,587
  • 7
  • 23
  • 67
4
votes
1 answer

SwiftUI: Malfunctioning NavigationBar and TabBar in iOS 15

In SwiftUI, I would like to use a background color for my view while also setting navigationViewStyle to .stack, to force a single-column stack navigation Plus-sized devices. var body: some View { TabView { NavigationView { …
Pim
  • 2,128
  • 18
  • 30
4
votes
0 answers

SwiftUI NavigationView list not dismissing itself when NavigationLink is clicked on iPads running iOS 15 in portrait orientation

Since iOS 15, clicking a NavigationLink in a NavigationView sometimes does not dismiss its nested list / sidebar on iPads in portrait orientation. The first click will dismiss the list, then it gets stuck. You can drag / scroll the list up and down…
SVP
  • 2,773
  • 3
  • 11
  • 14
4
votes
0 answers

iOS 15 Status Bar Background Color in SwiftUI/UIKit Nav mix

We have an app which uses a mix of UIKit and SwiftUI. The nav hierarchy is: UIKit Tab Bar > UIKit Table > SwiftUI View > UIKit View as of iOS 15 the status bar is not taking on the color of the nav bar: I'm trying to figure out if this is something…
lewis
  • 2,936
  • 2
  • 37
  • 72
4
votes
2 answers

Swiftui: align selected text in picker to leading edge

Currently I've a picker included in a Section included in a Form what I'm trying to reach is to align the selected value of the picker to the leading in both iOS 13 and 14, I've tried many solutions such as labelsHidden() but with no result, kindly…
4
votes
1 answer

SwiftUI: How can I determine if a view is presented in a NavigationView, Sheet, or is the root?

I'm working on a project that requires a custom navigation bar that will have custom buttons and title styling, while also allowing an accessory view below the main nav portion. Essentially, I'd like to abstract away the need to choose the custom…
Ben M
  • 2,405
  • 1
  • 20
  • 19
4
votes
0 answers

SwiftUI: showing keyboard in a tab view adds a weird space below second tab view

This sounds a bug in SwiftUI's NavigationView and TabView, when I have a TabView with (let's say) 2 tabs, the first tab has a TextField and the second tab has a NavigationView, follow these steps to produce the bug: show the keyboard by tapping on…
JAHelia
  • 6,934
  • 17
  • 74
  • 134
4
votes
1 answer

SwiftUI - 3 Column/Sidebar Layout with All Visible?

I'm experimenting with SwiftUI's new support for multi-column sidebar layouts. I know that I can do something like this: struct SidebarContentView: View { var body: some View { NavigationView { List { …
Shadowman
  • 11,150
  • 19
  • 100
  • 198
4
votes
2 answers

SwiftUI: How to align a NavigationBarItem with a large title navigation title?

No matter what I've tried I cannot get this navigation bar item to align with the large title on this View? I have tried padding or placing it in a VStack with a Spacer() but neither push it down. How can I properly align it? var body: some View…
GarySabo
  • 5,806
  • 5
  • 49
  • 124
4
votes
1 answer

how to add a toolbar divider for a three column view in swiftUI life cycle

I am looking for a way to achieve a Toolbar for a three column layout like Mail.app. Also the Notes.app uses almost the same Toolbar with the only important difference between the two apps being that Notes.app looks like it's WindowStyle is a…
Enie
  • 649
  • 5
  • 18
4
votes
2 answers

SwiftUI NavigationLink highlight staying highlighted after returning to previous view

I have a series of views in SwiftUI. One is a "Menu View" which consists of a List of NavigationLinks wrapped in a NavigationView. The code is as follows. var body: some View { NavigationView { List { HStack { …
4
votes
2 answers

SwiftUI - How to remove white background behind List that is styled with SidebarListStyle, in portrait mode

I have a list styled with SidebarListStyle (new in iOS 14) inside a NavigationView. struct ContentView: View { let data = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen",…
aheze
  • 24,434
  • 8
  • 68
  • 125
4
votes
1 answer

SwiftUI - NavigationLink is not working with a button

I am making an app where I take two number inputs and want to show the addition result of the numbers in the second screen, when a button is clicked. I can print the result in the console, but unfortunately it seems like navigation link is not…
tanvirgeek
  • 79
  • 2
  • 6
3
votes
0 answers

How to know when SwiftUI presentation has finished?

I want to know when my SwiftUI view has finished it's transition/animation in order to safely present additional views/modals. Example: I am in View A showing Sheet A. Within Sheet A I tap a button that dismisses Sheet A, transitions from View A to…