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

Dynamically set SwiftUI NavigationBarItems?

How can you dynamically change SwiftUI Navigation Bar Items? I have a TabView within a NavigationView, and I would like the Navigation Bar Items to change depending on tab that is selected. However, I am having a hard time determining how to change…
Brandogs
  • 145
  • 13
2
votes
0 answers

Customize sidebar button image in split-view

I have a SwiftUI app. On iPad, the sidebar icon (top-left) appears when split-view is active. I can't hide it using .navigationBarBackButtonHidden(true) to make my own custom one. How can I fix this? Code: struct ContentView: View { var…
George
  • 25,988
  • 10
  • 79
  • 133
2
votes
1 answer

How to replace the current view in SwiftUI?

I am developing an app with SwiftUI. I have a NavigationView and I have buttons on the navigation bar. I want to replace the current view (which is a result of a TabView selection) with another one. Basically, when the user clicks "Edit" button, I…
1
vote
0 answers

SwiftUI not updating based on @StateObject

I am new to SwiftUI. I am trying to update an array of mockFlights (in this case as a dummy test just at index 0 for departureAirportIata:) with a string from the TextField. The data are displayed from the array as they should and when using button…
1
vote
1 answer

Loading UIkit Views and swiftUI view from SwiftUI NavigationView With stack style navigation

I wanted to create common class for navigation bar and navigationView used throughout the project in SwiftUI. In my project some of the screens are in UIKit and some of the screens are in UIKIT. What is best architecture to implement such type of…
1
vote
2 answers

How do I get the background in swiftui to scale to fit the whole screen

I'm still pretty new to swift UI, almost finished a project however no matter what I try I cannot get the background to take up the whole screen space, with the code below it still has a white border surrounding the image on all sides, I've tried…
1
vote
1 answer

SwiftUI NaviagtionLink Arrows

I have the problem that the arrows are always shown with. i have tried things like .buttonsytel(PlainButtonStyle()) or similar. Also with .frame(0).opacity(0), or .hidden, but nothing was displayed. How can I hide the arrows? List { …
1
vote
1 answer

NavigationLink is not working on Custom defined Button SwiftUI iOS

I've have defined a custom button in my SwiftUI file as following. struct CircleButtonWithIcon: View { @State private var navigateToHomePage = false var body: some View { Button(action: { }) { …
1
vote
0 answers

SwiftUI - NavigationStack: Why my NavigationPath() is printing the wrong path.count?

I have the following basic utilization of NavigationStack with SwiftUI for iOS 16, Xcode. The issues I am facing is that when I click back and printing the count, the root count is wrong and shows as "1" instead of always showing as "0". Why and how…
1
vote
1 answer

SwiftUI: RoundedRectangle ignores safe area?

I'm learning SwiftUI and noticed some weird behaviour regarding RoundedRectangle, which is used to draw dividers. See in the screenshot below, the RoundedRectangle with width = 1 ignores top and bottom safe area, where as if I use Divider() instead,…
Heuristic
  • 5,087
  • 9
  • 54
  • 94
1
vote
3 answers

NavigationLink back not working with @Binding

My app supports iOS 15.0 so, I can not use NavigationPath. So, I've added NavigationView and used NavigationLink for navigation. Here is my simple app flow. FirstView -> SecondView -> ThirdView -> ForthView I want to navigate from ForthView to…
Mrugesh Tank
  • 3,495
  • 2
  • 29
  • 59
1
vote
1 answer

How to I show a NavigationLink in a DisclosedGroup (SwiftUI)?

I'm trying to show a few items such as NavigationView in a DisclosureGroup and the group when opened shows nothing. Can someone help me (I'm just starting with SwiftUI)? An example of what I want to do: import SwiftUI @main struct ContentView: App…
1
vote
1 answer

How to replace back button of NavigationView from inside a UIViewControllerRepresentable?

Consider a UIVIewController where a custom back button needs to be set. The reason is that the user should be presented a confirmation dialog before navigating back where they can cancel the navigation, in case the back button was tapped…
Manuel
  • 14,274
  • 6
  • 57
  • 130
1
vote
1 answer

Navigation Title with custom view with large and small title transition

With navigationTitle we can set a specific Title to the navigation view ex: "Rows" . So when the view is loaded we get large text title and when it scrolled the title font reduces and aligns to the center. However is it possible to have a custom…
NNikN
  • 3,720
  • 6
  • 44
  • 86
1
vote
0 answers

SwiftUI NavigationView drawer hidden in iPad Portrait

I have a SwiftUI master / detail NavigationView, with the master view being a list of countries, and the detail view being a list of cities in each country. This works fine in every layout (macOS catalyst, iPhone, iPad) except on an iPad in portrait…
Alnitak
  • 334,560
  • 70
  • 407
  • 495